diff options
117 files changed, 4077 insertions, 3150 deletions
@@ -53,9 +53,18 @@ committers: company: 'ATT' id: 'xuegao' timezone: 'Europe/Brussels' + - name: 'Adam Krysiak' + email: 'adam.krysiak@nokia.com' + company: 'Nokia' + id: 'akrysiak' + timezone: 'Europe/Warsaw' tsc: approval: 'https://lists.onap.org/pipermail/onap-tsc' changes: - type: 'Addition' name: 'Gervais-Martial Ngueko' link: 'https://lists.onap.org/g/ONAP-TSC/message/3311' + - type: 'Addition' + name: 'Adam Krysiak' + link: 'https://lists.onap.org/g/ONAP-TSC/message/3311' + @@ -122,7 +122,48 @@ You can see the swagger definition for the jaxrs apis at `/restservices/clds/v1/ ## Clamp Credentials
-Credentials should be specified in `src/main/resources/clds/clds-users.json`. You might specify you own credential file by redefining the `clamp.config.files.cldsUsers` in `application.properties`.
+There are two mechanisms that can enabled for the authentication, one or the other never both at the same time.
+They can be enabled in the application.properties.
+
+1. AAF CA
+There is a section for SSL enablement and cadi configuration (for AAF) + one spring profile to enable
+
+server.port=8443
+server.ssl.key-store=classpath:/clds/aaf/org.onap.clamp.p12
+server.ssl.key-store-password=China in the Spring
+server.ssl.key-password=China in the Spring
+server.ssl.key-store-type=PKCS12
+server.ssl.key-alias=clamp@clamp.onap.org
+server.ssl.client-auth=want
+server.ssl.trust-store=classpath:/clds/aaf/truststoreONAPall.jks
+server.ssl.trust-store-password=changeit
+
+server.http-to-https-redirection.port=8080
+....
+spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller
+....
+clamp.config.cadi.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile
+clamp.config.cadi.cadiLoglevel=DEBUG
+clamp.config.cadi.cadiLatitude=37.78187
+clamp.config.cadi.cadiLongitude=-122.26147
+clamp.config.cadi.aafLocateUrl=https://aaf.api.simpledemo.onap.org:8095
+clamp.config.cadi.cadiKeystorePassword=enc:V_kq_EwDNb4itWp_lYfDGXIWJzemHGkhkZOxAQI9IHs
+clamp.config.cadi.cadiTruststorePassword=enc:Mj0YQqNCUKbKq2lPp1kTFQWeqLxaBXKNwd5F1yB1ukf
+clamp.config.cadi.aafEnv=DEV
+clamp.config.cadi.aafUrl=https://AAF_LOCATE_URL/AAF_NS.service:2.0
+clamp.config.cadi.cadiX509Issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US
+
+In that case a certificate must be added in the browser and is required to login properly
+Please check that section to get the certificate
+https://wiki.onap.org/display/DW/Control+Loop+Flows+and+Models+for+Casablanca#ControlLoopFlowsandModelsforCasablanca-Configure
+
+Or it can be found in the Clamp source code folder src/main/resources/clds/aaf
+(Default Password: "China in the Spring")
+
+2. Spring authentication
+It's possible to enable the spring authentication by disabling the "clamp-aaf-authentication" profile and enabling only the "clamp-default-user"
+spring.profiles.active=clamp-default,clamp-default-user,clamp-sdc-controller
+In that case, the credentials should be specified in `src/main/resources/clds/clds-users.json`. You might specify you own credential file by redefining the `clamp.config.files.cldsUsers` in `application.properties`.
Passwords should be hashed using Bcrypt :
```
@@ -132,4 +173,9 @@ Passwords should be hashed using Bcrypt : Default credentials are admin/password and cs0008/password.
+There is a spring file that disables the AAF and enable the Spring authentication by default.
+To use it just add
+--spring.config.name=application-noaaf
+
+to the jvm parameters. This file is available by default in the java classpath resource folder.
\ No newline at end of file diff --git a/docs/architecture.rst b/docs/architecture.rst index e526fb064..fc9e6c322 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -39,6 +39,6 @@ operational costs compared to traditional methods. |closed-loop| -.. |clamp-flow| image:: images/distdepl.png -.. |dashboard-flow| image:: images/monitoring.png -.. |closed-loop| image:: images/ONAP-closedloop.png
\ No newline at end of file +.. |clamp-flow| image:: images/architecture/distdepl.png +.. |dashboard-flow| image:: images/architecture/monitoring.png +.. |closed-loop| image:: images/architecture/ONAP-closedloop.png
\ No newline at end of file diff --git a/docs/images/ONAP-closedloop.png b/docs/images/architecture/ONAP-closedloop.png Binary files differindex 7d3a2cac8..7d3a2cac8 100644 --- a/docs/images/ONAP-closedloop.png +++ b/docs/images/architecture/ONAP-closedloop.png diff --git a/docs/images/distdepl.png b/docs/images/architecture/distdepl.png Binary files differindex 5593f4986..5593f4986 100755..100644 --- a/docs/images/distdepl.png +++ b/docs/images/architecture/distdepl.png diff --git a/docs/images/monitoring.png b/docs/images/architecture/monitoring.png Binary files differindex 6dbf75e45..6dbf75e45 100755..100644 --- a/docs/images/monitoring.png +++ b/docs/images/architecture/monitoring.png diff --git a/docs/images/user-guide/config-policy-tca1.png b/docs/images/user-guide/config-policy-tca1.png Binary files differnew file mode 100644 index 000000000..032bc9a2e --- /dev/null +++ b/docs/images/user-guide/config-policy-tca1.png diff --git a/docs/images/user-guide/deploy-params.png b/docs/images/user-guide/deploy-params.png Binary files differnew file mode 100644 index 000000000..d51a41ac8 --- /dev/null +++ b/docs/images/user-guide/deploy-params.png diff --git a/docs/images/user-guide/deploy.png b/docs/images/user-guide/deploy.png Binary files differnew file mode 100644 index 000000000..8f12aa1b6 --- /dev/null +++ b/docs/images/user-guide/deploy.png diff --git a/docs/images/user-guide/distributed.png b/docs/images/user-guide/distributed.png Binary files differnew file mode 100644 index 000000000..4a765a994 --- /dev/null +++ b/docs/images/user-guide/distributed.png diff --git a/docs/images/user-guide/op-policy-box-policy1.png b/docs/images/user-guide/op-policy-box-policy1.png Binary files differnew file mode 100644 index 000000000..ffd9733bd --- /dev/null +++ b/docs/images/user-guide/op-policy-box-policy1.png diff --git a/docs/images/user-guide/op-policy-box.png b/docs/images/user-guide/op-policy-box.png Binary files differnew file mode 100644 index 000000000..107d2670d --- /dev/null +++ b/docs/images/user-guide/op-policy-box.png diff --git a/docs/images/user-guide/open-box.png b/docs/images/user-guide/open-box.png Binary files differnew file mode 100644 index 000000000..d38cdb4cf --- /dev/null +++ b/docs/images/user-guide/open-box.png diff --git a/docs/images/user-guide/open-menu-prop.png b/docs/images/user-guide/open-menu-prop.png Binary files differnew file mode 100644 index 000000000..f8d6438b9 --- /dev/null +++ b/docs/images/user-guide/open-menu-prop.png diff --git a/docs/images/user-guide/open-menu.png b/docs/images/user-guide/open-menu.png Binary files differnew file mode 100644 index 000000000..8ca5e86f1 --- /dev/null +++ b/docs/images/user-guide/open-menu.png diff --git a/docs/images/user-guide/opened-closed-loop.png b/docs/images/user-guide/opened-closed-loop.png Binary files differnew file mode 100644 index 000000000..ea854c427 --- /dev/null +++ b/docs/images/user-guide/opened-closed-loop.png diff --git a/docs/images/user-guide/prop-box.png b/docs/images/user-guide/prop-box.png Binary files differnew file mode 100644 index 000000000..54027b4fa --- /dev/null +++ b/docs/images/user-guide/prop-box.png diff --git a/docs/images/user-guide/save-cl.png b/docs/images/user-guide/save-cl.png Binary files differnew file mode 100644 index 000000000..7e0439d1c --- /dev/null +++ b/docs/images/user-guide/save-cl.png diff --git a/docs/images/user-guide/submit-menu.png b/docs/images/user-guide/submit-menu.png Binary files differnew file mode 100644 index 000000000..641055e2f --- /dev/null +++ b/docs/images/user-guide/submit-menu.png diff --git a/docs/images/user-guide/undeploy.png b/docs/images/user-guide/undeploy.png Binary files differnew file mode 100644 index 000000000..c17fa89ee --- /dev/null +++ b/docs/images/user-guide/undeploy.png diff --git a/docs/index.rst b/docs/index.rst index 43fb315f6..677c32b12 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -190,12 +190,15 @@ For OOM, the URL is https://<host-ip>:30258/designer/index.html - With AAF enabled, the certificate p12 must be added to the browser ca path: src/main/resources/clds/aaf/org.onap.clamp.p12, password "China in the Spring" + Or get it from this page : https://wiki.onap.org/display/DW/Control+Loop+Flows+and+Models+for+Casablanca Human Interfaces ---------------- .. Basic info on the interface type, ports/protocols provided over, etc. User Interface (CLAMP Designer) - serve to configure control loop +CLAMP UI is used to configure the Control Loop designed and distributed by SDC. From that UI it's possible to distribute the configuration policies and control the life-cycle of the DCAE Micro Services. + The following actions are done using the UI: * Design a control loop flow by selecting a predefined template from a list @@ -219,8 +222,14 @@ The following actions are done using the UI: * Control (start/stop) the operation of the control loop in DCAE - - HealthCheck API - serve to verify CLAMP status (see offered API's section) * https://<host-ip>:8443/restservices/clds/v1/healthcheck This one does not require the certificate + +Walk-through can be found here: https://wiki.onap.org/display/DW/CLAMP+videos + +.. toctree:: + :maxdepth: 1 + :titlesonly: + + CLAMP User Guide <user-guide.rst>
\ No newline at end of file diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 95fab086f..0c3f36878 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -23,7 +23,7 @@ one documentation issue was fixed, this issue does not require a new docker imag Version: 3.0.3 -------------- -:Release Date: 2018-11-13 +:Release Date: 2018-11-30 **New Features** diff --git a/docs/user-guide.rst b/docs/user-guide.rst new file mode 100644 index 000000000..dca5bb80f --- /dev/null +++ b/docs/user-guide.rst @@ -0,0 +1,103 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. + +Open Closed loop in CLAMP +------------------------- +There is 2 closed loop levels in CLAMP: +- Closed loop template: This is created from the DCAE blueprint (designed in the DCAE designer), and distributed by SDC to CLAMP. +- Closed loop instance: Based on the template, it represents a physical closed loop in the platform related to a service and a VNF. + This is created in CLAMP when receiving the SDC notification, as this one is related to a specific service/vnf. + +There is no way to design a closed loop from scratch in CLAMP, you can only configure it and manage its life-cycle. +For more info on how to design the service in SDC, check this: https://wiki.onap.org/display/DW/CLAMP+videos#CLAMPvideos-DesignpartinSDC + +There is a specific menu to open distributed closed loops in CLAMP UI. + +|clamp-open-menu| + +Please note that the option "Create CL" can be used to create a closed loop from the template distributed by SDC, you can therefore instantiate it for another service/vnf + +Once you click on "Open CL", this dialog box is shown + +|clamp-open-box| + +Once the distributed closed loop has been chosen, the closed loop is shown to the user + +|clamp-opened-closed-loop| + +Closed Loop properties +---------------------- +You can check to which service/vnf the closed loop has been associated in SDC. + +|clamp-menu-prop| + +This opens a box that gives the properties set during the SDC notification deployment in CLAMP. +Do not change those settings + +|clamp-prop-box| + +Operational policy properties +----------------------------- +The box "policy" is clickable, so the operational policies can be defined. +By clicking on the button "New Policy", it's possible to add new operational policies that can chosen in the configuration policy. + +|clamp-op-policy-box| + +Once clicked, it's possible to configure each operational policy that can also contain multiple "sub policies", one per Recipe + +|clamp-op-policy-box-policy1| + +Configuration policy properties +------------------------------- +The box "tca" is clickable, so the TCA configuration policy can be defined. +In that popup dialog, multiple Thresholds can be defined, the operational policies defined previously can be chosen and set in the "Policy" field. + +|clamp-config-policy-tca1| + +Saving Closed loop +------------------ +Once all properties have been defined for all policies, the closed loop must be saved. + +|clamp-save-cl| + +Submitting the Closed loop to policy +------------------------------------ +In the "Manage Menu", the submit action can be used to send the configuration to policy engine. +The "Validation test" can be used to check the data configured in the closed loop without sending anything to policy engine. + +|clamp-submit-cl| + +If everything is successful, this changes the status to "Distributed" + +|clamp-distributed| + +Deploy/undeploy the Closed loop to DCAE +--------------------------------------- +Once sent to policy engine, Clamp can ask to DCAE to deploy the micro service + +|clamp-deploy| + +This opens a window where the parameters of the DCAE micro service can be configured/tuned. +The policy_id is automatically generated by Clamp in the previous steps. + +|clamp-deploy-params| + +Once deployed on DCAE the status Closed loop status goes to ACTIVE, it can then be Undeployed/Stopped or even Updated (this is to push new policies on policy engine) + +|clamp-undeploy| + +.. |clamp-open-menu| image:: images/user-guide/open-menu.png +.. |clamp-open-box| image:: images/user-guide/open-box.png +.. |clamp-opened-closed-loop| image:: images/user-guide/opened-closed-loop.png +.. |clamp-menu-prop| image:: images/user-guide/open-menu-prop.png +.. |clamp-prop-box| image:: images/user-guide/prop-box.png +.. |clamp-op-policy-box| image:: images/user-guide/op-policy-box.png +.. |clamp-op-policy-box-policy1| image:: images/user-guide/op-policy-box-policy1.png +.. |clamp-config-policy-tca1| image:: images/user-guide/config-policy-tca1.png +.. |clamp-save-cl| image:: images/user-guide/save-cl.png +.. |clamp-submit-cl| image:: images/user-guide/submit-menu.png +.. |clamp-distributed| image:: images/user-guide/distributed.png +.. |clamp-deploy| image:: images/user-guide/deploy.png +.. |clamp-deploy-params| image:: images/user-guide/deploy-params.png +.. |clamp-undeploy| image:: images/user-guide/undeploy.png
\ No newline at end of file @@ -24,7 +24,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.clamp</groupId> <artifactId>clds</artifactId> - <version>3.0.3-SNAPSHOT</version> + <version>4.0.0-SNAPSHOT</version> <name>clamp</name> <parent> @@ -60,13 +60,11 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <docker.mariadb.port.host>3306</docker.mariadb.port.host> - <docker.http-cache.port.host>8085</docker.http-cache.port.host> <project.scm.id>git-server</project.scm.id> <java.version>1.8</java.version> <eelf.core.version>1.0.0</eelf.core.version> - <camel.version>2.22.0</camel.version> + <camel.version>2.22.1</camel.version> <springboot.version>2.0.6.RELEASE</springboot.version> <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> @@ -397,7 +395,7 @@ <dependency> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineAPI</artifactId> - <version>1.3.1</version> + <version>1.3.3</version> <exclusions> <exclusion> <groupId>com.google.guava</groupId> @@ -671,6 +669,38 @@ </resources> <plugins> + <plugin> + <groupId>org.sonatype.plugins</groupId> + <artifactId>port-allocator-maven-plugin</artifactId> + <version>1.2</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>allocate-ports</goal> + </goals> + <configuration> + <ports> + <port> + <name>docker.mariadb.port.host</name> + </port> + <port> + <name>docker.http-cache.port.host</name> + </port> + <port> + <name>clamp.it.tests.http-redirected</name> + </port> + <port> + <name>clamp.it.tests.https</name> + </port> + <port> + <name>clamp.it.tests.http</name> + </port> + </ports> + </configuration> + </execution> + </executions> + </plugin> <!-- Read the swagger.json file and the definition from SwaggerConfig.java; generate a list of .adoc files containing the APIs info in more structured way --> @@ -858,9 +888,10 @@ <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> <configuration> - <forkCount>1</forkCount> + <forkCount>1C</forkCount> <reuseForks>true</reuseForks> <useSystemClassLoader>false</useSystemClassLoader> + <argLine>${surefireArgLine}</argLine> </configuration> </plugin> @@ -883,8 +914,9 @@ <include>**/*ItCase.java</include> </includes> <forkCount>1</forkCount> - <reuseForks>false</reuseForks> + <reuseForks>true</reuseForks> <useSystemClassLoader>false</useSystemClassLoader> + <argLine>${failsafeArgLine}</argLine> </configuration> </execution> </executions> @@ -893,10 +925,17 @@ <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> - <version>0.26.0</version> + <version>0.27.2</version> + <dependencies> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.5.5</version> + </dependency> + </dependencies> <configuration> <verbose>true</verbose> - <apiVersion>1.23</apiVersion> + <apiVersion>1.35</apiVersion> <images> <image> <name>library/mariadb:10.1.11</name> @@ -1045,10 +1084,10 @@ <version>0.8.2</version> <configuration> <dumpOnExit>true</dumpOnExit> + <append>true</append> <includes> <include>org.onap.clamp.*</include> </includes> - <propertyName>surefireArgLine</propertyName> </configuration> <executions> <execution> @@ -1058,6 +1097,7 @@ </goals> <configuration> <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile> + <propertyName>surefireArgLine</propertyName> <!-- <append>true</append> --> </configuration> </execution> @@ -1069,6 +1109,7 @@ </goals> <configuration> <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile> + <propertyName>failsafeArgLine</propertyName> <!-- <append>true</append> --> </configuration> </execution> diff --git a/src/main/java/org/onap/clamp/clds/ClampServlet.java b/src/main/java/org/onap/clamp/clds/ClampServlet.java index 516325cbe..008a9c743 100644 --- a/src/main/java/org/onap/clamp/clds/ClampServlet.java +++ b/src/main/java/org/onap/clamp/clds/ClampServlet.java @@ -36,7 +36,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.camel.component.servlet.CamelHttpTransportServlet; -import org.onap.aaf.cadi.principal.X509Principal; import org.onap.clamp.clds.service.SecureServicePermission; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; @@ -62,11 +61,24 @@ public class ClampServlet extends CamelHttpTransportServlet { public static final String PERM_VF = "clamp.config.security.permission.type.filter.vf"; public static final String PERM_MANAGE = "clamp.config.security.permission.type.cl.manage"; public static final String PERM_TOSCA = "clamp.config.security.permission.type.tosca"; + public static final String AUTHENTICATION_CLASS = "clamp.config.security.authentication.class"; private static List<SecureServicePermission> permissionList; + private synchronized Class loadDynamicAuthenticationClass() { + try { + String authenticationObject = WebApplicationContextUtils.getWebApplicationContext(getServletContext()) + .getEnvironment().getProperty(AUTHENTICATION_CLASS); + return Class.forName(authenticationObject); + } catch (ClassNotFoundException e) { + logger.error( + "Exception caught when attempting to create associated class of config:" + AUTHENTICATION_CLASS, e); + return Object.class; + } + } + private synchronized List<SecureServicePermission> getPermissionList() { if (permissionList == null) { - permissionList=new ArrayList<>(); + permissionList = new ArrayList<>(); ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(getServletContext()); String cldsPermissionInstance = applicationContext.getEnvironment().getProperty(PERM_INSTANCE); @@ -97,9 +109,8 @@ public class ClampServlet extends CamelHttpTransportServlet { @Override protected void doService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - Principal p = request.getUserPrincipal(); - if (p instanceof X509Principal) { + if (loadDynamicAuthenticationClass().isInstance(p)) { // When AAF is enabled, there is a need to provision the permissions to Spring // system List<GrantedAuthority> grantedAuths = new ArrayList<>(); diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java index 16c18ae0e..4151c7aad 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java @@ -18,7 +18,7 @@ * limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.client;
@@ -64,7 +64,6 @@ public class DcaeDispatcherServices { this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;
}
-
public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {
String operationStatus = "";
for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {
@@ -83,9 +82,9 @@ public class DcaeDispatcherServices { /**
* Get the Operation Status from a specified URL.
- *
+ *
* @param statusUrl
- * The URL provided by a previous DCAE Query
+ * The URL provided by a previous DCAE Query
* @return The status
*/
public String getOperationStatus(String statusUrl) {
@@ -113,35 +112,14 @@ public class DcaeDispatcherServices { }
/**
- * This method send a getDeployments operation to DCAE.
- */
- public void getDeployments() {
- Date startTime = new Date();
- LoggingUtils.setTargetContext("DCAE", "getDeployments");
- try {
- String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX;
- dcaeHttpConnectionManager.doDcaeHttpQuery(url, "GET", null, null);
- LoggingUtils.setResponseContext("0", "Get deployments success", this.getClass().getName());
- } catch (Exception e) {
- LoggingUtils.setResponseContext("900", "Get deployments failed", this.getClass().getName());
- LoggingUtils.setErrorContext("900", "Get deployments error");
- logger.error("Exception occurred during getDeployments Operation with DCAE", e);
- throw new DcaeDeploymentException("Exception occurred during getDeployments Operation with DCAE", e);
- } finally {
- LoggingUtils.setTimeContext(startTime, new Date());
- metricsLogger.info("getDeployments complete");
- }
- }
-
- /**
* Returns status URL for createNewDeployment operation.
*
* @param deploymentId
- * The deployment ID
+ * The deployment ID
* @param serviceTypeId
- * Service type ID
+ * Service type ID
* @param blueprintInputJson
- * The value for each blueprint parameters in a flat JSON
+ * The value for each blueprint parameters in a flat JSON
* @return The status URL
*/
public String createNewDeployment(String deploymentId, String serviceTypeId, JsonNode blueprintInputJson) {
@@ -157,7 +135,7 @@ public class DcaeDispatcherServices { logger.info("Dcae api Body String - " + apiBodyString);
String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX + deploymentId;
String statusUrl = getDcaeResponse(url, "PUT", apiBodyString, "application/json", DCAE_LINK_FIELD,
- DCAE_STATUS_FIELD);
+ DCAE_STATUS_FIELD);
LoggingUtils.setResponseContext("0", "Create new deployment failed", this.getClass().getName());
return statusUrl;
} catch (Exception e) {
@@ -173,11 +151,11 @@ public class DcaeDispatcherServices { /***
* Returns status URL for deleteExistingDeployment operation.
- *
+ *
* @param deploymentId
- * The deployment ID
+ * The deployment ID
* @param serviceTypeId
- * The service Type ID
+ * The service Type ID
* @return The status URL
*/
public String deleteExistingDeployment(String deploymentId, String serviceTypeId) {
@@ -188,7 +166,7 @@ public class DcaeDispatcherServices { logger.info("Dcae api Body String - " + apiBodyString);
String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX + deploymentId;
String statusUrl = getDcaeResponse(url, "DELETE", apiBodyString, "application/json", DCAE_LINK_FIELD,
- DCAE_STATUS_FIELD);
+ DCAE_STATUS_FIELD);
LoggingUtils.setResponseContext("0", "Delete existing deployment success", this.getClass().getName());
return statusUrl;
@@ -197,7 +175,7 @@ public class DcaeDispatcherServices { LoggingUtils.setErrorContext("900", "Delete existing deployment error");
logger.error("Exception occurred during deleteExistingDeployment Operation with DCAE", e);
throw new DcaeDeploymentException("Exception occurred during deleteExistingDeployment Operation with DCAE",
- e);
+ e);
} finally {
LoggingUtils.setTimeContext(startTime, new Date());
metricsLogger.info("deleteExistingDeployment complete");
@@ -205,7 +183,7 @@ public class DcaeDispatcherServices { }
private String getDcaeResponse(String url, String requestMethod, String payload, String contentType, String node,
- String nodeAttr) throws IOException, ParseException {
+ String nodeAttr) throws IOException, ParseException {
Date startTime = new Date();
try {
String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(url, requestMethod, payload, contentType);
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java index b63bb646d..327aff1da 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java @@ -19,7 +19,7 @@ * ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.client;
@@ -27,14 +27,11 @@ package org.onap.clamp.clds.client; import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.util.Date;
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;
@@ -61,32 +58,30 @@ public class DcaeInventoryServices { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- private static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
- private static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval";
- private static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";
- public static final String DCAE_TYPE_NAME = "typeName";
- public static final String DCAE_TYPE_ID = "typeId";
+ public static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
+ public static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval";
+ public static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";
private final ClampProperties refProp;
private final CldsDao cldsDao;
private final DcaeHttpConnectionManager dcaeHttpConnectionManager;
@Autowired
- public DcaeInventoryServices(ClampProperties refProp, CldsDao cldsDao, DcaeHttpConnectionManager dcaeHttpConnectionManager) {
+ public DcaeInventoryServices(ClampProperties refProp, CldsDao cldsDao,
+ DcaeHttpConnectionManager dcaeHttpConnectionManager) {
this.refProp = refProp;
this.cldsDao = cldsDao;
this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;
}
-
/**
* Set the event inventory.
- *
+ *
* @param cldsModel
- * The CldsModel
+ * The CldsModel
* @param userId
- * The user ID
+ * The user ID
* @throws ParseException
- * In case of DCAE Json parse exception
+ * In case of DCAE Json parse exception
*/
public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException, InterruptedException {
String artifactName = cldsModel.getControlName();
@@ -100,7 +95,7 @@ public class DcaeInventoryServices { try {
// Below are the properties required for calling the dcae inventory
ModelProperties prop = new ModelProperties(cldsModel.getName(), cldsModel.getControlName(), null, false,
- "{}", cldsModel.getPropText());
+ "{}", cldsModel.getPropText());
Global global = prop.getGlobal();
String invariantServiceUuid = global.getService();
List<String> resourceUuidList = global.getResourceVf();
@@ -130,7 +125,7 @@ public class DcaeInventoryServices { }
private void analyzeAndSaveDcaeResponse(DcaeInventoryResponse dcaeResponse, CldsModel cldsModel,
- DcaeEvent dcaeEvent, String userId) {
+ DcaeEvent dcaeEvent, String userId) {
if (dcaeResponse != null) {
logger.info("Dcae Response for query on inventory: " + dcaeResponse);
String oldTypeId = cldsModel.getTypeId();
@@ -141,9 +136,9 @@ public class DcaeInventoryServices { cldsModel.setTypeName(dcaeResponse.getTypeName());
}
if (oldTypeId == null || !cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_DISTRIBUTE)
- || cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE)) {
+ || cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE)) {
CldsEvent.insEvent(cldsDao, dcaeEvent.getControlName(), userId, dcaeEvent.getCldsActionCd(),
- CldsEvent.ACTION_STATE_RECEIVED, null);
+ CldsEvent.ACTION_STATE_RECEIVED, null);
}
cldsModel.save(cldsDao, userId);
} else {
@@ -160,37 +155,37 @@ public class DcaeInventoryServices { }
private DcaeInventoryResponse getItemsFromDcaeInventoryResponse(String responseStr)
- throws ParseException, IOException {
+ throws ParseException, IOException {
JSONParser parser = new JSONParser();
Object obj0 = parser.parse(responseStr);
JSONObject jsonObj = (JSONObject) obj0;
JSONArray itemsArray = (JSONArray) jsonObj.get("items");
JSONObject dcaeServiceType0 = (JSONObject) itemsArray.get(0);
return JacksonUtils.getObjectMapperInstance().readValue(dcaeServiceType0.toString(),
- DcaeInventoryResponse.class);
+ DcaeInventoryResponse.class);
}
/**
* DO a query to DCAE to get some Information.
- *
+ *
* @param artifactName
- * The artifact Name
+ * The artifact Name
* @param serviceUuid
- * The service UUID
+ * The service UUID
* @param resourceUuid
- * The resource UUID
+ * The resource UUID
* @return The DCAE inventory for the artifact in DcaeInventoryResponse
* @throws IOException
- * In case of issues with the stream
+ * In case of issues with the stream
* @throws ParseException
- * In case of issues with the Json parsing
+ * In case of issues with the Json parsing
*/
public DcaeInventoryResponse getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)
- throws IOException, ParseException, InterruptedException {
+ throws IOException, ParseException, InterruptedException {
Date startTime = new Date();
LoggingUtils.setTargetContext("DCAE", "getDcaeInformation");
String queryString = "?asdcResourceId=" + resourceUuid + "&asdcServiceId=" + serviceUuid + "&typeName="
- + artifactName;
+ + artifactName;
String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types" + queryString;
logger.info("Dcae Inventory Service full url - " + fullUrl);
DcaeInventoryResponse response = queryDcaeInventory(fullUrl);
@@ -200,7 +195,7 @@ public class DcaeInventoryServices { }
private DcaeInventoryResponse queryDcaeInventory(String fullUrl)
- throws IOException, InterruptedException, ParseException {
+ throws IOException, InterruptedException, ParseException {
int retryInterval = 0;
int retryLimit = 1;
if (refProp.getStringValue(DCAE_INVENTORY_RETRY_LIMIT) != null) {
@@ -219,115 +214,11 @@ public class DcaeInventoryServices { return getItemsFromDcaeInventoryResponse(response);
}
logger.info(
- "Dcae inventory totalCount returned is 0, so waiting " + retryInterval + "ms before retrying ...");
+ "Dcae inventory totalCount returned is 0, so waiting " + retryInterval + "ms before retrying ...");
// wait for a while and try to connect to DCAE again
Thread.sleep(retryInterval);
}
logger.warn("Dcae inventory totalCount returned is still 0, after " + retryLimit + " attempts, returning NULL");
return null;
}
-
- /**
- * Inserts a new DCAEServiceType or updates an existing instance. If the
- * typeName is same second time(already exists) then the
- * DCAEServiceTypeRequest is updated
- *
- * @param blueprintTemplate
- * blueprint content
- * @param owner
- * owner of the data
- * @param typeName
- * The type/artifact Name
- * @param typeVersion
- * type version
- * @param asdcServiceId
- * The service UUID
- * @param asdcResourceId
- * The vf UUID
- * @return The DCAE inventory type id
- */
- public String createupdateDCAEServiceType(String blueprintTemplate, String owner, String typeName, int typeVersion,
- String asdcServiceId, String asdcResourceId) {
- Date startTime = new Date();
- LoggingUtils.setTargetContext("DCAE", "createDCAEServiceType");
- String typeId = null;
- try {
- ObjectNode dcaeServiceTypeRequest = JacksonUtils.getObjectMapperInstance().createObjectNode();
- dcaeServiceTypeRequest.put("blueprintTemplate", blueprintTemplate);
- dcaeServiceTypeRequest.put("owner", owner);
- dcaeServiceTypeRequest.put("typeName", typeName);
- dcaeServiceTypeRequest.put("typeVersion", typeVersion);
- dcaeServiceTypeRequest.put("asdcServiceId", asdcServiceId);
- dcaeServiceTypeRequest.put("asdcResourceId", asdcResourceId);
- String apiBodyString = dcaeServiceTypeRequest.toString();
- logger.info("Dcae api Body String - " + apiBodyString);
- String url = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types";
- String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(url, "POST", apiBodyString,
- "application/json");
- // If the DCAEServiceTypeRequest is created successfully it will
- // return a json object responce containing a node for newly created
- // "typeId"
- // The newly generated DCAEServiceTypeRequest can then be accessed
- // via URL: https://<DCAE_INVENTORY_URL>/dcae-service-types/<typeId>
- JSONParser parser = new JSONParser();
- Object obj0 = parser.parse(responseStr);
- JSONObject jsonObj = (JSONObject) obj0;
- typeId = (String) jsonObj.get("typeId"); // need to save this
- // as
- // service_type_id
- // in model table
- } catch (IOException | ParseException e) {
- logger.error("Exception occurred during createupdateDCAEServiceType Operation with DCAE", e);
- throw new BadRequestException("Exception occurred during createupdateDCAEServiceType Operation with DCAE",
- e);
- } finally {
- if (typeId != null) {
- LoggingUtils.setResponseContext("0", "Create update DCAE ServiceType success",
- this.getClass().getName());
- } else {
- LoggingUtils.setResponseContext("900", "Create update DCAE ServiceType failed",
- this.getClass().getName());
- LoggingUtils.setErrorContext("900", "Create update DCAE ServiceType error");
- }
- LoggingUtils.setTimeContext(startTime, new Date());
- metricsLogger.info("createupdateDCAEServiceType complete");
- }
- return typeId;
- }
-
- /**
- * Method to delete blueprint from dcae inventory if it's exists.
- *
- * @param typeName
- * @param serviceUuid
- * @param resourceUuid
- * @throws InterruptedException
- */
- public void deleteDCAEServiceType(String typeName, String serviceUuid, String resourceUuid)
- throws InterruptedException {
- Date startTime = new Date();
- LoggingUtils.setTargetContext("DCAE", "deleteDCAEServiceType");
- boolean result = false;
- try {
- DcaeInventoryResponse inventoryResponse = getDcaeInformation(typeName, serviceUuid, resourceUuid);
- if (inventoryResponse != null && inventoryResponse.getTypeId() != null) {
- String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types/"
- + inventoryResponse.getTypeId();
- dcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "DELETE", null, null);
- }
- result = true;
- } catch (IOException | ParseException e) {
- logger.error("Exception occurred during deleteDCAEServiceType Operation with DCAE", e);
- throw new BadRequestException("Exception occurred during deleteDCAEServiceType Operation with DCAE", e);
- } finally {
- if (result) {
- LoggingUtils.setResponseContext("0", "Delete DCAE ServiceType success", this.getClass().getName());
- } else {
- LoggingUtils.setResponseContext("900", "Delete DCAE ServiceType failed", this.getClass().getName());
- LoggingUtils.setErrorContext("900", "Delete DCAE ServiceType error");
- }
- LoggingUtils.setTimeContext(startTime, new Date());
- metricsLogger.info("deleteDCAEServiceType completed");
- }
- }
}
diff --git a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java index 872999356..adec94f32 100644 --- a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java @@ -52,7 +52,7 @@ public class OperationalPolicyDeleteDelegate { * Perform activity. Delete Operational Policy via policy api. * * @param camelExchange - * The Camel Exchange object containing the properties + * The Camel Exchange object containing the properties */ @Handler public void execute(Exchange camelExchange) { @@ -60,14 +60,11 @@ public class OperationalPolicyDeleteDelegate { Policy policy = prop.getType(Policy.class); prop.setCurrentModelElementId(policy.getId()); String eventAction = (String) camelExchange.getProperty("eventAction"); - String responseMessage = ""; - if (!eventAction.equalsIgnoreCase(CldsEvent.ACTION_CREATE) && policy.isFound()) { + if (policy.getPolicyChains() != null && !policy.getPolicyChains().isEmpty() + && !eventAction.equalsIgnoreCase(CldsEvent.ACTION_CREATE) && policy.isFound()) { for (PolicyChain policyChain : policy.getPolicyChains()) { prop.setPolicyUniqueId(policyChain.getPolicyId()); - responseMessage = policyClient.deleteBrms(prop); - } - if (responseMessage != null) { - camelExchange.setProperty("operationalPolicyDeleteResponseMessage", responseMessage.getBytes()); + logger.info("Policy Delete response: " + policyClient.deleteBrms(prop)); } } } diff --git a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java b/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java deleted file mode 100644 index 3a3d0158c..000000000 --- a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.client; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.io.IOException; -import java.security.GeneralSecurityException; -import java.util.List; - -import org.apache.camel.Exchange; -import org.apache.camel.Handler; -import org.apache.commons.codec.DecoderException; -import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices; -import org.onap.clamp.clds.client.req.sdc.SdcRequests; -import org.onap.clamp.clds.config.ClampProperties; -import org.onap.clamp.clds.model.DcaeEvent; -import org.onap.clamp.clds.model.properties.Global; -import org.onap.clamp.clds.model.properties.ModelProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * Send control loop model to dcae proxy. - */ -@Component -public class SdcSendReqDelegate { - - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcSendReqDelegate.class); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - @Autowired - private SdcCatalogServices sdcCatalogServices; - @Autowired - private SdcRequests sdcReq; - @Autowired - private ClampProperties refProp; - - /** - * Perform activity. Send to sdc proxy. - * - * @param camelExchange - * The camel object that contains all fields - * @throws DecoderException - * In case of issues with password decryption - * @throws GeneralSecurityException - * In case of issues with password decryption - * @throws IOException - * In case of issues with file opening - */ - @Handler - public void execute(Exchange camelExchange) throws GeneralSecurityException, DecoderException, IOException { - String controlName = (String) camelExchange.getProperty("controlName"); - String artifactLabel = sdcReq - .normalizeResourceInstanceName(refProp.getStringValue("sdc.artifactLabel") + "-" + controlName); - String locationArtifactLabel = sdcReq - .normalizeResourceInstanceName(refProp.getStringValue("sdc.locationArtifactLabel") + "-" + controlName); - String artifactType = refProp.getStringValue("sdc.artifactType"); - String locationArtifactType = refProp.getStringValue("sdc.locationArtifactType"); - String userid = (String) camelExchange.getProperty("userid"); - String docText = (String) camelExchange.getProperty("docText"); - String artifactName = (String) camelExchange.getProperty("controlName") + DcaeEvent.ARTIFACT_NAME_SUFFIX; - camelExchange.setProperty("artifactName", artifactName); - ModelProperties prop = ModelProperties.create(camelExchange); - String bluprintPayload; - bluprintPayload = sdcReq.formatBlueprint(prop, docText); - // no need to upload blueprint for Holmes, thus blueprintPayload for - // Holmes is empty - if (!bluprintPayload.isEmpty()) { - String formattedSdcReq = sdcReq.formatSdcReq(bluprintPayload, artifactName, artifactLabel, artifactType); - if (formattedSdcReq != null) { - camelExchange.setProperty("formattedArtifactReq", formattedSdcReq.getBytes()); - } - Global globalProps = prop.getGlobal(); - if (globalProps != null && globalProps.getService() != null) { - String serviceInvariantUUID = globalProps.getService(); - camelExchange.setProperty("serviceInvariantUUID", serviceInvariantUUID); - } - List<String> sdcReqUrlsList = sdcReq.getSdcReqUrlsList(prop); - String sdcLocationsPayload = sdcReq.formatSdcLocationsReq(prop, artifactName); - String locationArtifactName = (String) camelExchange.getProperty("controlName") + "-location.json"; - String formattedSdcLocationReq = sdcReq.formatSdcReq(sdcLocationsPayload, locationArtifactName, - locationArtifactLabel, locationArtifactType); - if (formattedSdcLocationReq != null) { - camelExchange.setProperty("formattedLocationReq", formattedSdcLocationReq.getBytes()); - } - sdcCatalogServices.uploadToSdc(prop, userid, sdcReqUrlsList, formattedSdcReq, formattedSdcLocationReq, - artifactName, locationArtifactName); - } - } -} diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java b/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java index de86faa21..f15d33df2 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java +++ b/src/main/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructor.java @@ -35,16 +35,28 @@ import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.model.properties.PolicyChain; import org.onap.clamp.clds.model.properties.PolicyItem; import org.onap.policy.api.AttributeType; -import org.onap.policy.api.RuleProvider; public class GuardPolicyAttributesConstructor { + public static final String ACTOR = "actor"; + public static final String RECIPE = "recipe"; + public static final String TARGETS = "targets"; + public static final String CLNAME = "clname"; + public static final String MIN = "min"; + public static final String MAX = "max"; + public static final String LIMIT = "limit"; + public static final String TIME_WINDOW = "timeWindow"; + public static final String TIME_UNITS = "timeUnits"; + public static final String GUARD_ACTIVE_START = "guardActiveStart"; + public static final String GUARD_ACTIVE_END = "guardActiveEnd"; + private static final EELFLogger logger = EELFManager.getInstance() .getLogger(GuardPolicyAttributesConstructor.class); private GuardPolicyAttributesConstructor() { } - public static Map<AttributeType, Map<String, String>> formatAttributes(ModelProperties modelProperties, PolicyItem policyItem) { + public static Map<AttributeType, Map<String, String>> formatAttributes(ModelProperties modelProperties, + PolicyItem policyItem) { Map<String, String> matchingAttributes = prepareMatchingAttributes(policyItem, modelProperties); return createAttributesMap(matchingAttributes); } @@ -62,20 +74,20 @@ public class GuardPolicyAttributesConstructor { private static Map<String, String> prepareMatchingAttributes(PolicyItem policyItem, ModelProperties modelProp) { logger.info("Preparing matching attributes for guard..."); Map<String, String> matchingAttributes = new HashMap<>(); - matchingAttributes.put("actor",policyItem.getActor()); - matchingAttributes.put("recipe",policyItem.getRecipe()); - matchingAttributes.put("targets",policyItem.getGuardTargets()); - matchingAttributes.put("clname",modelProp.getControlNameAndPolicyUniqueId()); - if (RuleProvider.GUARD_MIN_MAX.equals(RuleProvider.valueOf(policyItem.getGuardPolicyType()))) { - matchingAttributes.put("min",policyItem.getMinGuard()); - matchingAttributes.put("max",policyItem.getMaxGuard()); - } else if (RuleProvider.GUARD_YAML.equals(RuleProvider.valueOf(policyItem.getGuardPolicyType()))) { - matchingAttributes.put("limit",policyItem.getLimitGuard()); - matchingAttributes.put("timeWindow",policyItem.getTimeWindowGuard()); - matchingAttributes.put("timeUnits",policyItem.getTimeUnitsGuard()); + matchingAttributes.put(ACTOR, policyItem.getActor()); + matchingAttributes.put(RECIPE, policyItem.getRecipe()); + matchingAttributes.put(TARGETS, policyItem.getGuardTargets()); + matchingAttributes.put(CLNAME, modelProp.getControlNameAndPolicyUniqueId()); + if ("GUARD_MIN_MAX".equals(policyItem.getGuardPolicyType())) { + matchingAttributes.put(MIN, policyItem.getMinGuard()); + matchingAttributes.put(MAX, policyItem.getMaxGuard()); + } else if ("GUARD_YAML".equals(policyItem.getGuardPolicyType())) { + matchingAttributes.put(LIMIT, policyItem.getLimitGuard()); + matchingAttributes.put(TIME_WINDOW, policyItem.getTimeWindowGuard()); + matchingAttributes.put(TIME_UNITS, policyItem.getTimeUnitsGuard()); } - matchingAttributes.put("guardActiveStart",policyItem.getGuardActiveStart()); - matchingAttributes.put("guardActiveEnd",policyItem.getGuardActiveEnd()); + matchingAttributes.put(GUARD_ACTIVE_START, policyItem.getGuardActiveStart()); + matchingAttributes.put(GUARD_ACTIVE_END, policyItem.getGuardActiveEnd()); logger.info("Prepared: " + matchingAttributes); return matchingAttributes; diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java index c26b15ce7..c7051157d 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java +++ b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java @@ -26,6 +26,11 @@ package org.onap.clamp.clds.client.req.policy; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Collection; import java.util.Date; import java.util.Map; @@ -36,6 +41,7 @@ import javax.ws.rs.BadRequestException; import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.config.PolicyConfiguration; import org.onap.clamp.clds.exception.policy.PolicyClientException; +import org.onap.clamp.clds.model.CldsToscaModel; import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.model.properties.PolicyItem; import org.onap.clamp.clds.util.LoggingUtils; @@ -44,6 +50,8 @@ import org.onap.policy.api.ConfigRequestParameters; import org.onap.policy.api.DeletePolicyCondition; import org.onap.policy.api.DeletePolicyParameters; import org.onap.policy.api.DictionaryType; +import org.onap.policy.api.ImportParameters; +import org.onap.policy.api.ImportParameters.IMPORT_TYPE; import org.onap.policy.api.PolicyChangeResponse; import org.onap.policy.api.PolicyClass; import org.onap.policy.api.PolicyConfigException; @@ -77,6 +85,7 @@ public class PolicyClient { public static final String POLICY_MS_NAME_PREFIX_PROPERTY_NAME = "policy.ms.policyNamePrefix"; public static final String POLICY_OP_TYPE_PROPERTY_NAME = "policy.op.type"; public static final String POLICY_GUARD_SUFFIX = "_Guard"; + public static final String TOSCA_FILE_TEMP_PATH = "tosca.filePath"; @Autowired protected ApplicationContext appContext; @@ -113,8 +122,8 @@ public class PolicyClient { // Set a random UUID(Mandatory) policyParameters.setRequestID(UUID.fromString(policyRequestUuid)); - String rtnMsg = send(policyParameters, prop, null); - push(DictionaryType.Decision.toString(), prop); + String rtnMsg = send(policyParameters, prop, null, null); + push(DictionaryType.Decision.toString(), prop, null); return rtnMsg; } @@ -144,9 +153,9 @@ public class PolicyClient { // Set a random UUID(Mandatory) policyParameters.setRequestID(UUID.fromString(policyRequestUuid)); String policyNamePrefix = refProp.getStringValue(POLICY_OP_NAME_PREFIX_PROPERTY_NAME); - String rtnMsg = send(policyParameters, prop, policyNamePrefix); + String rtnMsg = send(policyParameters, prop, policyNamePrefix, null); String policyType = refProp.getStringValue(POLICY_OP_TYPE_PROPERTY_NAME); - push(policyType, prop); + push(policyType, prop, null); return rtnMsg; } @@ -174,9 +183,9 @@ public class PolicyClient { // Adding this line to clear the policy id from policy name while // pushing to policy engine prop.setPolicyUniqueId(""); - String rtnMsg = send(policyParameters, prop, policyNamePrefix); + String rtnMsg = send(policyParameters, prop, policyNamePrefix, null); String policyType = refProp.getStringValue(POLICY_MSTYPE_PROPERTY_NAME); - push(policyType, prop); + push(policyType, prop, null); return rtnMsg; } @@ -209,8 +218,9 @@ public class PolicyClient { // Adding this line to clear the policy id from policy name while // pushing to policy engine prop.setPolicyUniqueId(""); - String rtnMsg = send(policyParameters, prop, refProp.getStringValue(POLICY_BASENAME_PREFIX_PROPERTY_NAME)); - push(PolicyConfigType.Base.toString(), prop); + String rtnMsg = send(policyParameters, prop, refProp.getStringValue(POLICY_BASENAME_PREFIX_PROPERTY_NAME), + null); + push(PolicyConfigType.Base.toString(), prop, null); return rtnMsg; } @@ -234,9 +244,9 @@ public class PolicyClient { // Adding this line to clear the policy id from policy name while // pushing to policy engine prop.setPolicyUniqueId(""); - String rtnMsg = send(policyParameters, prop, policyNamePrefix); + String rtnMsg = send(policyParameters, prop, policyNamePrefix, null); String policyType = refProp.getStringValue(POLICY_MSTYPE_PROPERTY_NAME); - push(policyType, prop); + push(policyType, prop, null); return rtnMsg; } @@ -249,7 +259,8 @@ public class PolicyClient { * The ModelProperties * @return The response message of Policy */ - protected String send(PolicyParameters policyParameters, ModelProperties prop, String policyNamePrefix) { + protected String send(PolicyParameters policyParameters, ModelProperties prop, String policyPrefix, + String policyNameWithPrefix) { // Verify whether it is triggered by Validation Test button from UI if (prop.isTestOnly()) { return "send not executed for test action"; @@ -261,7 +272,7 @@ public class PolicyClient { try { if ((PolicyClass.Decision.equals(policyParameters.getPolicyClass()) && !checkDecisionPolicyExists(prop)) || (PolicyClass.Config.equals(policyParameters.getPolicyClass()) - && !checkPolicyExists(policyNamePrefix, prop))) { + && !checkPolicyExists(prop, policyPrefix, policyNameWithPrefix))) { LoggingUtils.setTargetContext("Policy", "createPolicy"); logger.info("Attempting to create policy for action=" + prop.getActionCd()); response = getPolicyEngine().createPolicy(policyParameters); @@ -302,22 +313,13 @@ public class PolicyClient { * The ModelProperties * @return The response message of policy */ - protected String push(String policyType, ModelProperties prop) { + protected String push(String policyType, ModelProperties prop, String policyName) { // Verify whether it is triggered by Validation Test button from UI if (prop.isTestOnly()) { return "push not executed for test action"; } PushPolicyParameters pushPolicyParameters = new PushPolicyParameters(); - // Parameter arguments - if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) { - if (DictionaryType.Decision.toString().equals(policyType)) { - pushPolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueGuardId()); - } else { - pushPolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueId()); - } - } else { - pushPolicyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName()); - } + pushPolicyParameters.setPolicyName(selectRightPolicyName(prop, policyType, policyName)); logger.info("Policy Name in Push policy method - " + pushPolicyParameters.getPolicyName()); pushPolicyParameters.setPolicyType(policyType); pushPolicyParameters.setPdpGroup(refProp.getStringValue("policy.pdp.group")); @@ -365,7 +367,7 @@ public class PolicyClient { logger.info("Search in Policy Engine for DecisionpolicyName=" + prop.getPolicyScopeAndNameWithUniqueGuardId()); try { // No other choice than pushing to see if it exists or not - String response = push(DictionaryType.Decision.toString(), prop); + String response = push(DictionaryType.Decision.toString(), prop, null); if (response != null) { policyexists = true; } @@ -388,17 +390,11 @@ public class PolicyClient { * @throws PolicyConfigException * In case of issues with policy engine */ - protected boolean checkPolicyExists(String policyNamePrefix, ModelProperties prop) { + protected boolean checkPolicyExists(ModelProperties prop, String policyPrefix, String policyNameWithPrefix) { boolean policyexists = false; String policyName = ""; try { - - if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) { - policyName = prop.getCurrentPolicyScopeAndFullPolicyName(policyNamePrefix) + "_" - + prop.getPolicyUniqueId(); - } else { - policyName = prop.getCurrentPolicyScopeAndFullPolicyName(policyNamePrefix); - } + policyName = selectRightPolicyNameWithPrefix(prop, policyPrefix, policyNameWithPrefix); logger.info("Search in Policy Engine for policyName=" + policyName); ConfigRequestParameters configRequestParameters = new ConfigRequestParameters(); @@ -441,9 +437,9 @@ public class PolicyClient { String deletePolicyResponse = ""; try { String policyNamePrefix = refProp.getStringValue(POLICY_MS_NAME_PREFIX_PROPERTY_NAME); - if (checkPolicyExists(policyNamePrefix, prop)) { + if (checkPolicyExists(prop, policyNamePrefix, null)) { String policyType = refProp.getStringValue(POLICY_MSTYPE_PROPERTY_NAME); - deletePolicyResponse = deletePolicy(prop, policyType); + deletePolicyResponse = deletePolicy(prop, policyType, null); } } catch (Exception e) { logger.error("Exception occurred during policy communication", e); @@ -460,7 +456,7 @@ public class PolicyClient { * @return A string with the answer from policy */ public String deleteBasePolicy(ModelProperties prop) { - return deletePolicy(prop, PolicyConfigType.Base.toString()); + return deletePolicy(prop, PolicyConfigType.Base.toString(), null); } /** @@ -475,7 +471,7 @@ public class PolicyClient { try { if (checkDecisionPolicyExists(prop)) { - deletePolicyResponse = deletePolicy(prop, DictionaryType.Decision.toString()); + deletePolicyResponse = deletePolicy(prop, DictionaryType.Decision.toString(), null); } } catch (Exception e) { logger.error("Exception occurred during policy communication", e); @@ -495,9 +491,9 @@ public class PolicyClient { String deletePolicyResponse = ""; try { String policyNamePrefix = refProp.getStringValue(POLICY_OP_NAME_PREFIX_PROPERTY_NAME); - if (checkPolicyExists(policyNamePrefix, prop)) { + if (checkPolicyExists(prop, policyNamePrefix, null)) { String policyType = refProp.getStringValue(POLICY_OP_TYPE_PROPERTY_NAME); - deletePolicyResponse = deletePolicy(prop, policyType); + deletePolicyResponse = deletePolicy(prop, policyType, null); } } catch (Exception e) { logger.error("Exception occurred during policy communication", e); @@ -506,25 +502,60 @@ public class PolicyClient { return deletePolicyResponse; } + protected String selectRightPolicyName(ModelProperties prop, String policyType, String policyName) { + if (policyName == null) { + if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) { + if (DictionaryType.Decision.toString().equals(policyType)) { + return prop.getPolicyScopeAndNameWithUniqueGuardId(); + } else { + return prop.getPolicyScopeAndNameWithUniqueId(); + } + } else { + return prop.getCurrentPolicyScopeAndPolicyName(); + } + } else { + return policyName; + } + } + /** - * Format and send delete PAP and PDP requests to Policy. + * Method to return correct policy name with prefix * * @param prop * The ModelProperties - * @return The response message from policy + * @param policyPrefix + * Policy Prefix + * @param policyNameWithPrefix + * Policy Name With Prefix + * @return */ - protected String deletePolicy(ModelProperties prop, String policyType) { - DeletePolicyParameters deletePolicyParameters = new DeletePolicyParameters(); - if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) { - if (DictionaryType.Decision.toString().equals(policyType)) { - deletePolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueGuardId()); + protected String selectRightPolicyNameWithPrefix(ModelProperties prop, String policyPrefix, + String policyNameWithPrefix) { + if (policyNameWithPrefix == null) { + if (prop.getPolicyUniqueId() != null && !prop.getPolicyUniqueId().isEmpty()) { + return prop.getCurrentPolicyScopeAndFullPolicyName(policyPrefix) + "_" + prop.getPolicyUniqueId(); } else { - deletePolicyParameters.setPolicyName(prop.getPolicyScopeAndNameWithUniqueId()); + return prop.getCurrentPolicyScopeAndFullPolicyName(policyPrefix); } } else { - deletePolicyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName()); + return policyNameWithPrefix; } + } + + /** + * Format and send delete PAP and PDP requests to Policy. + * + * @param prop + * The ModelProperties + * @param policyType + * The policyType "Decision" or + * @return The response message from policy + */ + protected String deletePolicy(ModelProperties prop, String policyType, String policyName) { + DeletePolicyParameters deletePolicyParameters = new DeletePolicyParameters(); + deletePolicyParameters.setPolicyName(selectRightPolicyName(prop, policyType, policyName)); logger.info("Policy Name in delete policy method - " + deletePolicyParameters.getPolicyName()); + logger.info("Deleting policy from PDP..."); deletePolicyParameters.setPolicyComponent("PDP"); deletePolicyParameters.setDeleteCondition(DeletePolicyCondition.ALL); deletePolicyParameters.setPdpGroup(refProp.getStringValue("policy.pdp.group")); @@ -572,4 +603,81 @@ public class PolicyClient { } return responseMessage; } + + /** + * Create a temp Tosca model file and perform import model to Policy Engine + * + * @param cldsToscaModel + * Policy model details + * @return The response message from policy + */ + public String importToscaModel(CldsToscaModel cldsToscaModel) { + String filePath = ""; + try { + String clampToscaPath = refProp.getStringValue(TOSCA_FILE_TEMP_PATH); + filePath = buildFilePathForToscaFile(clampToscaPath, cldsToscaModel.getToscaModelName()); + logger.info("Writing Tosca model : " + filePath); + Path path = Paths.get(filePath); + Files.createDirectories(path.getParent()); + // Create or Ovewrite an existing the file + try (OutputStream out = Files.newOutputStream(path)) { + out.write(cldsToscaModel.getToscaModelYaml().getBytes(), 0, + cldsToscaModel.getToscaModelYaml().getBytes().length); + } + } catch (IOException e) { + logger.error("Exception caught when attempting to write Tosca files to disk", e); + throw new PolicyClientException("Exception caught when attempting to write Tosca files to disk", e); + } + + ImportParameters importParameters = new ImportParameters(); + importParameters.setImportParameters(cldsToscaModel.getToscaModelName(), cldsToscaModel.getToscaModelName(), + null, filePath, IMPORT_TYPE.MICROSERVICE, String.valueOf(cldsToscaModel.getVersion())); + return importModel(importParameters); + } + + /** + * @param importParameters + * The ImportParameters + * @return The response message from policy + */ + private String importModel(ImportParameters importParameters) { + PolicyChangeResponse response = null; + String responseMessage = ""; + + try { + logger.info("Attempting to import tosca policy model for action=" + importParameters.getFilePath()); + response = getPolicyEngine().policyEngineImport(importParameters); + if (response != null) { + responseMessage = response.getResponseMessage(); + } + } catch (Exception e) { + LoggingUtils.setResponseContext("900", "Policy Model import failed", this.getClass().getName()); + LoggingUtils.setErrorContext("900", "Policy Model import error"); + logger.error("Exception occurred during policy communication", e); + throw new PolicyClientException("Exception while communicating with Policy", e); + } + logger.info(LOG_POLICY_PREFIX + responseMessage); + if (response != null && (response.getResponseCode() == 200 || response.getResponseCode() == 204)) { + LoggingUtils.setResponseContext("0", "Policy Model import success", this.getClass().getName()); + logger.info("Policy import model successful"); + metricsLogger.info("Policy import model success"); + } else { + LoggingUtils.setResponseContext("900", "Policy import model failed", this.getClass().getName()); + logger.warn("Policy import model failed: " + responseMessage); + metricsLogger.info("Policy import model failure"); + throw new BadRequestException("Policy import model failed: " + responseMessage); + } + return responseMessage; + } + + /** + * @param clampToscaPath + * Temp directory path for writing tosca files + * @param toscaModelName + * Tosca Model Name + * @return File Path on the system + */ + private String buildFilePathForToscaFile(String clampToscaPath, String toscaModelName) { + return clampToscaPath + "/" + toscaModelName + ".yml"; + } }
\ No newline at end of file diff --git a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java index 4422c92fe..cd7d4f2cc 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java +++ b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java @@ -19,7 +19,7 @@ * ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.client.req.sdc;
@@ -33,7 +33,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode;
import java.io.BufferedReader;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -50,10 +49,7 @@ import java.util.Date; import java.util.Iterator;
import java.util.List;
-import javax.ws.rs.BadRequestException;
-
import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import org.apache.commons.io.IOUtils;
@@ -66,9 +62,6 @@ import org.onap.clamp.clds.model.CldsServiceData; import org.onap.clamp.clds.model.CldsVfData;
import org.onap.clamp.clds.model.CldsVfKPIData;
import org.onap.clamp.clds.model.CldsVfcData;
-import org.onap.clamp.clds.model.properties.Global;
-import org.onap.clamp.clds.model.properties.ModelProperties;
-import org.onap.clamp.clds.model.sdc.SdcArtifact;
import org.onap.clamp.clds.model.sdc.SdcResource;
import org.onap.clamp.clds.model.sdc.SdcResourceBasicInfo;
import org.onap.clamp.clds.model.sdc.SdcServiceDetail;
@@ -87,17 +80,17 @@ public class SdcCatalogServices { private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcCatalogServices.class);
private static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- private static final String RESOURCE_VF_TYPE = "VF";
- private static final String RESOURCE_VFC_TYPE = "VFC";
- private static final String RESOURCE_CVFC_TYPE = "CVFC";
- private static final String SDC_REQUESTID_PROPERTY_NAME = "sdc.header.requestId";
- private static final String SDC_METADATA_URL_PREFIX = "/metadata";
- private static final String SDC_INSTANCE_ID_PROPERTY_NAME = "sdc.InstanceID";
- private static final String SDC_CATALOG_URL_PROPERTY_NAME = "sdc.catalog.url";
- private static final String SDC_SERVICE_URL_PROPERTY_NAME = "sdc.serviceUrl";
- private static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";
- private static final String RESOURCE_URL_PREFIX = "resources";
- private static final LoggingUtils utils = new LoggingUtils (logger);
+ public static final String RESOURCE_VF_TYPE = "VF";
+ public static final String RESOURCE_VFC_TYPE = "VFC";
+ public static final String RESOURCE_CVFC_TYPE = "CVFC";
+ public static final String SDC_REQUESTID_PROPERTY_NAME = "sdc.header.requestId";
+ public static final String SDC_METADATA_URL_PREFIX = "/metadata";
+ public static final String SDC_INSTANCE_ID_PROPERTY_NAME = "sdc.InstanceID";
+ public static final String SDC_CATALOG_URL_PROPERTY_NAME = "sdc.catalog.url";
+ public static final String SDC_SERVICE_URL_PROPERTY_NAME = "sdc.serviceUrl";
+ public static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";
+ public static final String RESOURCE_URL_PREFIX = "resources";
+ private static final LoggingUtils utils = new LoggingUtils(logger);
@Autowired
private ClampProperties refProp;
@@ -107,11 +100,11 @@ public class SdcCatalogServices { *
* @return The String with Basic Auth and password
* @throws GeneralSecurityException
- * In case of issue when decryting the SDC password
+ * In case of issue when decryting the SDC password
* @throws DecoderException
- * In case of issues with the decoding of the HexString message
+ * In case of issues with the decoding of the HexString message
*/
- private String getSdcBasicAuth() throws GeneralSecurityException, DecoderException {
+ public String getSdcBasicAuth() throws GeneralSecurityException, DecoderException {
String sdcId = refProp.getStringValue("sdc.serviceUsername");
String sdcPw = refProp.getStringValue("sdc.servicePassword");
String password = CryptoUtils.decrypt(sdcPw);
@@ -120,16 +113,16 @@ public class SdcCatalogServices { }
/**
- * This method get the SDC services Information with the corresponding
- * Service UUID.
- *
+ * This method get the SDC services Information with the corresponding Service
+ * UUID.
+ *
* @param uuid
- * The service UUID
+ * The service UUID
* @return A Json String with all the service list
* @throws GeneralSecurityException
- * In case of issue when decryting the SDC password
+ * In case of issue when decryting the SDC password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public String getSdcServicesInformation(String uuid) throws GeneralSecurityException, DecoderException {
Date startTime = new Date();
@@ -142,7 +135,7 @@ public class SdcCatalogServices { }
URL urlObj = new URL(url);
HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn = utils.invoke(conn,"SDC", "getSdcServicesInformation");
+ conn = utils.invoke(conn, "SDC", "getSdcServicesInformation");
conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), SDC_INSTANCE_ID_CLAMP);
conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json;charset=UTF-8");
@@ -166,9 +159,9 @@ public class SdcCatalogServices { /**
* To remove duplicate serviceUUIDs from sdc services List.
- *
+ *
* @param rawCldsSdcServiceList
- * A list of CldsSdcServiceInfo
+ * A list of CldsSdcServiceInfo
* @return A list of CldsSdcServiceInfo without duplicate service UUID
*/
public List<SdcServiceInfo> removeDuplicateServices(List<SdcServiceInfo> rawCldsSdcServiceList) {
@@ -195,7 +188,7 @@ public class SdcCatalogServices { /**
* To remove duplicate serviceUUIDs from sdc resources List.
- *
+ *
* @param rawCldsSdcResourceList
* @return List of CldsSdcResource
*/
@@ -223,12 +216,12 @@ public class SdcCatalogServices { /**
* To remove duplicate basic resources with same resourceUUIDs.
- *
+ *
* @param rawCldsSdcResourceListBasicList
* @return List of CldsSdcResourceBasicInfo
*/
public List<SdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(
- List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {
+ List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {
List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = new ArrayList<>();
if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {
// sort list
@@ -245,24 +238,24 @@ public class SdcCatalogServices { }
// add the last in the list
cldsSdcResourceBasicInfoList
- .add(rawCldsSdcResourceListBasicList.get(rawCldsSdcResourceListBasicList.size() - 1));
+ .add(rawCldsSdcResourceListBasicList.get(rawCldsSdcResourceListBasicList.size() - 1));
}
return cldsSdcResourceBasicInfoList;
}
/**
* To get ServiceUUID by using serviceInvariantUUID.
- *
+ *
* @param invariantId
- * The invariant ID
+ * The invariant ID
* @return The service UUID
* @throws GeneralSecurityException
- * In case of issue when decryting the SDC password
+ * In case of issue when decryting the SDC password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public String getServiceUuidFromServiceInvariantId(String invariantId)
- throws GeneralSecurityException, DecoderException {
+ throws GeneralSecurityException, DecoderException {
String serviceUuid = "";
String responseStr = getSdcServicesInformation(null);
List<SdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);
@@ -270,7 +263,7 @@ public class SdcCatalogServices { if (cldsSdcServicesList != null && !cldsSdcServicesList.isEmpty()) {
for (SdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {
if (currCldsSdcServiceInfo != null && currCldsSdcServiceInfo.getInvariantUUID() != null
- && currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {
+ && currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {
serviceUuid = currCldsSdcServiceInfo.getUuid();
break;
}
@@ -281,11 +274,11 @@ public class SdcCatalogServices { /**
* To get CldsAsdsServiceInfo class by parsing json string.
- *
+ *
* @param jsonStr
- * The Json string that must be decoded
- * @return The list of CldsSdcServiceInfo, if there is a failure it return
- * an empty list
+ * The Json string that must be decoded
+ * @return The list of CldsSdcServiceInfo, if there is a failure it return an
+ * empty list
*/
private List<SdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {
if (StringUtils.isBlank(jsonStr)) {
@@ -293,7 +286,7 @@ public class SdcCatalogServices { }
try {
return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()
- .getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class));
+ .getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class));
} catch (IOException e) {
logger.error("Error when attempting to decode the JSON containing CldsSdcServiceInfo", e);
return new ArrayList<>();
@@ -304,9 +297,8 @@ public class SdcCatalogServices { * To get List of CldsSdcResourceBasicInfo class by parsing json string.
*
* @param jsonStr
- * The JSOn string that must be decoded
- * @return The list of CldsSdcResourceBasicInfo, an empty list in case of
- * issues
+ * The JSOn string that must be decoded
+ * @return The list of CldsSdcResourceBasicInfo, an empty list in case of issues
*/
private List<SdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {
if (StringUtils.isBlank(jsonStr)) {
@@ -314,7 +306,7 @@ public class SdcCatalogServices { }
try {
return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()
- .getTypeFactory().constructCollectionType(List.class, SdcResourceBasicInfo.class));
+ .getTypeFactory().constructCollectionType(List.class, SdcResourceBasicInfo.class));
} catch (IOException e) {
logger.error("Exception occurred when attempting to decode the list of CldsSdcResourceBasicInfo JSON", e);
return new ArrayList<>();
@@ -323,7 +315,7 @@ public class SdcCatalogServices { /**
* To get CldsSdcServiceDetail by parsing json string.
- *
+ *
* @param jsonStr
* @return
*/
@@ -336,75 +328,7 @@ public class SdcCatalogServices { }
}
- // upload artifact to sdc based on serviceUUID and resource name on url
- private String uploadArtifactToSdc(ModelProperties prop, String userid, String url, String formattedSdcReq) {
- // Verify whether it is triggered by Validation Test button from UI
- if (prop.isTestOnly()) {
- return "sdc artifact upload not executed for test action";
- }
- try {
- logger.info("userid=" + userid);
- byte[] postData = formattedSdcReq.getBytes(StandardCharsets.UTF_8);
- int postDataLength = postData.length;
- HttpURLConnection conn = getSdcHttpUrlConnection(userid, postDataLength, url, formattedSdcReq);
- conn = utils.invoke(conn,"SDC", "uploadArtifact");
- try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
- wr.write(postData);
- }
- boolean requestFailed = true;
- int responseCode = conn.getResponseCode();
- logger.info("responseCode=" + responseCode);
- if (responseCode == 200) {
- requestFailed = false;
- }
- String responseStr = getResponse(conn);
- if (responseStr != null && requestFailed) {
- logger.error("requestFailed - responseStr=" + responseStr);
- utils.invokeReturn();
- throw new BadRequestException(responseStr);
- }
- utils.invokeReturn();
- return responseStr;
- } catch (IOException e) {
- logger.error("Exception when attempting to communicate with SDC", e);
- utils.invokeReturn();
- throw new SdcCommunicationException("Exception when attempting to communicate with SDC", e);
- }
- }
-
- private HttpURLConnection getSdcHttpUrlConnection(String userid, int postDataLength, String url, String content) {
- try {
- logger.info("userid=" + userid);
- String basicAuth = getSdcBasicAuth();
- String sdcXonapInstanceId = refProp.getStringValue("sdc.sdcX-InstanceID");
- URL urlObj = new URL(url);
- HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn.setDoOutput(true);
- conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), sdcXonapInstanceId);
- conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
- conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json");
- conn.setRequestProperty(HttpHeaders.CONTENT_MD5,
- Base64.getEncoder().encodeToString(DigestUtils.md5Hex(content).getBytes("UTF-8")));
- conn.setRequestProperty("USER_ID", userid);
- conn.setRequestMethod("POST");
- conn.setRequestProperty("charset", "utf-8");
- conn.setRequestProperty(HttpHeaders.CONTENT_LENGTH, Integer.toString(postDataLength));
- conn.setUseCaches(false);
- conn.setRequestProperty(refProp.getStringValue(SDC_REQUESTID_PROPERTY_NAME), LoggingUtils.getRequestId());
- return conn;
- } catch (IOException e) {
- logger.error("Exception when attempting to open connection with SDC", e);
- throw new SdcCommunicationException("Exception when attempting to open connection with SDC", e);
- } catch (DecoderException e) {
- logger.error("Exception when attempting to decode the Hex string", e);
- throw new SdcCommunicationException("Exception when attempting to decode the Hex string", e);
- } catch (GeneralSecurityException e) {
- logger.error("Exception when attempting to decrypt the encrypted password", e);
- throw new SdcCommunicationException("Exception when attempting to decrypt the encrypted password", e);
- }
- }
-
- private String getResponse(HttpURLConnection conn) {
+ public String getResponse(HttpURLConnection conn) {
try (InputStream is = getInputStream(conn)) {
try (BufferedReader in = new BufferedReader(new InputStreamReader(is))) {
return IOUtils.toString(in);
@@ -430,46 +354,45 @@ public class SdcCatalogServices { /**
* Check if the SDC Info in cache has expired.
- *
+ *
* @param cldsServiceData
- * The object representing the service data
+ * The object representing the service data
* @return boolean flag
* @throws GeneralSecurityException
- * In case of issues with the decryting the encrypted password
+ * In case of issues with the decryting the encrypted password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public boolean isCldsSdcCacheDataExpired(CldsServiceData cldsServiceData)
- throws GeneralSecurityException, DecoderException {
+ throws GeneralSecurityException, DecoderException {
if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) {
String cachedServiceUuid = cldsServiceData.getServiceUUID();
String latestServiceUuid = getServiceUuidFromServiceInvariantId(cldsServiceData.getServiceInvariantUUID());
String configuredMaxAge = refProp.getStringValue("clds.service.cache.invalidate.after.seconds");
if (configuredMaxAge == null) {
logger.warn(
- "clds.service.cache.invalidate.after.seconds NOT set in clds-reference.properties file, taking 60s as default");
+ "clds.service.cache.invalidate.after.seconds NOT set in clds-reference.properties file, taking 60s as default");
configuredMaxAge = "60";
}
return (!cachedServiceUuid.equalsIgnoreCase(latestServiceUuid)) || (cldsServiceData.getAgeOfRecord() != null
- && cldsServiceData.getAgeOfRecord() > Long.parseLong(configuredMaxAge));
+ && cldsServiceData.getAgeOfRecord() > Long.parseLong(configuredMaxAge));
} else {
return true;
}
}
/**
- * Get the Service Data with Alarm Conditions for a given
- * invariantServiceUuid.
- *
+ * Get the Service Data with Alarm Conditions for a given invariantServiceUuid.
+ *
* @param invariantServiceUuid
* @return The CldsServiceData
* @throws GeneralSecurityException
- * In case of issues with the decryting the encrypted password
+ * In case of issues with the decryting the encrypted password
* @throws DecoderException
- * In case of issues with the decoding of the Hex String
+ * In case of issues with the decoding of the Hex String
*/
public CldsServiceData getCldsServiceDataWithAlarmConditions(String invariantServiceUuid)
- throws GeneralSecurityException, DecoderException {
+ throws GeneralSecurityException, DecoderException {
String url = refProp.getStringValue(SDC_SERVICE_URL_PROPERTY_NAME);
String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);
String serviceUuid = getServiceUuidFromServiceInvariantId(invariantServiceUuid);
@@ -480,7 +403,7 @@ public class SdcCatalogServices { SdcServiceDetail cldsSdcServiceDetail;
try {
cldsSdcServiceDetail = JacksonUtils.getObjectMapperInstance().readValue(responseStr,
- SdcServiceDetail.class);
+ SdcServiceDetail.class);
} catch (IOException e) {
logger.error("Exception when decoding the CldsServiceData JSON from SDC", e);
throw new SdcCommunicationException("Exception when decoding the CldsServiceData JSON from SDC", e);
@@ -491,12 +414,12 @@ public class SdcCatalogServices { cldsServiceData.setServiceUUID(cldsSdcServiceDetail.getUuid());
cldsServiceData.setServiceInvariantUUID(cldsSdcServiceDetail.getInvariantUUID());
List<SdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(
- cldsSdcServiceDetail.getResources());
+ cldsSdcServiceDetail.getResources());
if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {
List<CldsVfData> cldsVfDataList = new ArrayList<>();
for (SdcResource currCldsSdcResource : cldsSdcResourceList) {
if (currCldsSdcResource != null && currCldsSdcResource.getResoucreType() != null
- && "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {
+ && "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {
CldsVfData currCldsVfData = new CldsVfData();
currCldsVfData.setVfName(currCldsSdcResource.getResourceInstanceName());
currCldsVfData.setVfInvariantResourceUUID(currCldsSdcResource.getResourceInvariantUUID());
@@ -514,20 +437,20 @@ public class SdcCatalogServices { }
private void getAllVfcForVfList(List<CldsVfData> cldsVfDataList, String catalogUrl)
- throws GeneralSecurityException {
+ throws GeneralSecurityException {
// todo : refact this..
if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {
List<SdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_VF_TYPE);
List<SdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(
- RESOURCE_VFC_TYPE);
+ RESOURCE_VFC_TYPE);
allVfcResources.addAll(getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_CVFC_TYPE));
for (CldsVfData currCldsVfData : cldsVfDataList) {
if (currCldsVfData != null && currCldsVfData.getVfInvariantResourceUUID() != null) {
String resourceUuid = getResourceUuidFromResourceInvariantUuid(
- currCldsVfData.getVfInvariantResourceUUID(), allVfResources);
+ currCldsVfData.getVfInvariantResourceUUID(), allVfResources);
if (resourceUuid != null) {
String vfResourceUuidUrl = catalogUrl + RESOURCE_URL_PREFIX + "/" + resourceUuid
- + SDC_METADATA_URL_PREFIX;
+ + SDC_METADATA_URL_PREFIX;
String vfResponse = getCldsServicesOrResourcesBasedOnURL(vfResourceUuidUrl);
if (vfResponse != null) {
// Below 2 line are to get the KPI(field path) data
@@ -542,22 +465,22 @@ public class SdcCatalogServices { // alarm conditions from artifact
for (CldsVfcData currCldsVfcData : vfcDataListFromVfResponse) {
if (currCldsVfcData != null
- && currCldsVfcData.getVfcInvariantResourceUUID() != null) {
+ && currCldsVfcData.getVfcInvariantResourceUUID() != null) {
String resourceVfcUuid = getResourceUuidFromResourceInvariantUuid(
- currCldsVfcData.getVfcInvariantResourceUUID(), allVfcResources);
+ currCldsVfcData.getVfcInvariantResourceUUID(), allVfcResources);
if (resourceVfcUuid != null) {
String vfcResourceUuidUrl = catalogUrl + RESOURCE_URL_PREFIX + "/"
- + resourceVfcUuid + SDC_METADATA_URL_PREFIX;
+ + resourceVfcUuid + SDC_METADATA_URL_PREFIX;
String vfcResponse = getCldsServicesOrResourcesBasedOnURL(
- vfcResourceUuidUrl);
+ vfcResourceUuidUrl);
if (vfcResponse != null) {
List<CldsAlarmCondition> alarmCondtionsFromVfc = getAlarmCondtionsFromVfc(
- vfcResponse);
+ vfcResponse);
currCldsVfcData.setCldsAlarmConditions(alarmCondtionsFromVfc);
}
} else {
logger.info("No resourceVFC UUID found for given invariantID:"
- + currCldsVfcData.getVfcInvariantResourceUUID());
+ + currCldsVfcData.getVfcInvariantResourceUUID());
}
}
}
@@ -566,7 +489,7 @@ public class SdcCatalogServices { }
} else {
logger.info("No resourceUUID found for given invariantREsourceUUID:"
- + currCldsVfData.getVfInvariantResourceUUID());
+ + currCldsVfData.getVfInvariantResourceUUID());
}
}
}
@@ -720,7 +643,7 @@ public class SdcCatalogServices { return null;
}
if (StringUtils.isBlank(record.get(1)) || StringUtils.isBlank(record.get(3))
- || StringUtils.isBlank(record.get(5))) {
+ || StringUtils.isBlank(record.get(5))) {
logger.debug("Invalid csv field path Record,one of column is having blank value : " + record);
return null;
}
@@ -764,7 +687,7 @@ public class SdcCatalogServices { return;
}
if (StringUtils.isBlank(record.get(1)) || StringUtils.isBlank(record.get(3))
- || StringUtils.isBlank(record.get(4))) {
+ || StringUtils.isBlank(record.get(4))) {
logger.debug("invalid csv alarm Record,one of column is having blank value : " + record);
return;
}
@@ -788,11 +711,11 @@ public class SdcCatalogServices { }
/**
- * Service to services/resources/artifacts from sdc.Pass alarmConditions as
- * true to get alarm conditons from artifact url and else it is false
- *
+ * Service to services/resources/artifacts from sdc.Pass alarmConditions as true
+ * to get alarm conditons from artifact url and else it is false
+ *
* @param url
- * The URL to trigger
+ * The URL to trigger
* @return The String containing the payload
*/
public String getCldsServicesOrResourcesBasedOnURL(String url) {
@@ -802,7 +725,7 @@ public class SdcCatalogServices { String urlReworked = removeUnwantedBracesFromString(url);
URL urlObj = new URL(urlReworked);
HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn = utils.invoke(conn,"SDC", "getSdcResources");
+ conn = utils.invoke(conn, "SDC", "getSdcResources");
String basicAuth = getSdcBasicAuth();
conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), SDC_INSTANCE_ID_CLAMP);
conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
@@ -841,7 +764,7 @@ public class SdcCatalogServices { * @param cldsServiceData
* @return
* @throws IOException
- * In case of issues during the parsing of the Global Properties
+ * In case of issues during the parsing of the Global Properties
*/
public String createPropertiesObjectByUUID(CldsServiceData cldsServiceData) throws IOException {
String totalPropsStr;
@@ -878,12 +801,12 @@ public class SdcCatalogServices { byIdObjectNode.putPOJO("byVfc", vfcResourceUuidObjectNode);
// To create byAlarmCondition with alarmConditionKey
List<CldsAlarmCondition> allAlarmConditions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,
- "alarmCondition");
+ "alarmCondition");
ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(allAlarmConditions);
byIdObjectNode.putPOJO("byAlarmCondition", alarmCondObjectNodeByAlarmKey);
// To create byAlertDescription with AlertDescription
List<CldsAlarmCondition> allAlertDescriptions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,
- "alertDescription");
+ "alertDescription");
ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(allAlertDescriptions);
byIdObjectNode.putPOJO("byAlertDescription", alertDescObjectNodeByAlert);
globalPropsJson.putPOJO("shared", byIdObjectNode);
@@ -895,19 +818,18 @@ public class SdcCatalogServices { /**
* Method to get alarm conditions/alert description from Service Data.
- *
+ *
* @param cldsServiceData
- * CldsServiceData the Service Data to analyze
+ * CldsServiceData the Service Data to analyze
* @param eventName
- * The String event name that will be used to filter the alarm
- * list
+ * The String event name that will be used to filter the alarm list
* @return The list of CldsAlarmCondition for the event name specified
*/
public List<CldsAlarmCondition> getAllAlarmConditionsFromCldsServiceData(CldsServiceData cldsServiceData,
- String eventName) {
+ String eventName) {
List<CldsAlarmCondition> alarmCondList = new ArrayList<>();
if (cldsServiceData != null && cldsServiceData.getCldsVfs() != null
- && !cldsServiceData.getCldsVfs().isEmpty()) {
+ && !cldsServiceData.getCldsVfs().isEmpty()) {
for (CldsVfData currCldsVfData : cldsServiceData.getCldsVfs()) {
alarmCondList.addAll(getAllAlarmConditionsFromCldsVfData(currCldsVfData, eventName));
}
@@ -917,12 +839,11 @@ public class SdcCatalogServices { /**
* Method to get alarm conditions/alert description from VF Data.
- *
+ *
* @param currCldsVfData
- * The Vf Data to analyze
+ * The Vf Data to analyze
* @param eventName
- * The String event name that will be used to filter the alarm
- * list
+ * The String event name that will be used to filter the alarm list
* @return The list of CldsAlarmCondition for the event name specified
*/
private List<CldsAlarmCondition> getAllAlarmConditionsFromCldsVfData(CldsVfData currCldsVfData, String eventName) {
@@ -937,22 +858,21 @@ public class SdcCatalogServices { /**
* Method to get alarm conditions/alert description from VFC Data.
- *
+ *
* @param currCldsVfcData
- * The VfC Data to analyze
+ * The VfC Data to analyze
* @param eventName
- * The String event name that will be used to filter the alarm
- * list
+ * The String event name that will be used to filter the alarm list
* @return The list of CldsAlarmCondition for the event name specified
*/
private List<CldsAlarmCondition> getAllAlarmConditionsFromCldsVfcData(CldsVfcData currCldsVfcData,
- String eventName) {
+ String eventName) {
List<CldsAlarmCondition> alarmCondList = new ArrayList<>();
if (currCldsVfcData != null && currCldsVfcData.getCldsAlarmConditions() != null
- && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
+ && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) {
if (currCldsAlarmCondition != null
- && currCldsAlarmCondition.getEventName().equalsIgnoreCase(eventName)) {
+ && currCldsAlarmCondition.getEventName().equalsIgnoreCase(eventName)) {
alarmCondList.add(currCldsAlarmCondition);
}
}
@@ -1002,7 +922,7 @@ public class SdcCatalogServices { }
private void createKpiObjectNodeByVfUuid(ObjectNode vfResourceUuidObjectNode,
- List<CldsVfKPIData> cldsVfKpiDataList) {
+ List<CldsVfKPIData> cldsVfKpiDataList) {
ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
if (cldsVfKpiDataList != null && !cldsVfKpiDataList.isEmpty()) {
for (CldsVfKPIData currCldsVfKpiData : cldsVfKpiDataList) {
@@ -1011,7 +931,7 @@ public class SdcCatalogServices { ObjectNode fieldPathObjectNode = mapper.createObjectNode();
ObjectNode nfNamingCodeNode = mapper.createObjectNode();
fieldPathObjectNode.put(currCldsVfKpiData.getFieldPathValue(),
- currCldsVfKpiData.getFieldPathValue());
+ currCldsVfKpiData.getFieldPathValue());
nfNamingCodeNode.put(currCldsVfKpiData.getNfNamingValue(), currCldsVfKpiData.getNfNamingValue());
thresholdNameObjectNode.putPOJO("fieldPath", fieldPathObjectNode);
thresholdNameObjectNode.putPOJO("nfNamingCode", nfNamingCodeNode);
@@ -1022,7 +942,7 @@ public class SdcCatalogServices { }
private void createAlarmCondObjectNodeByVfcUuid(ObjectNode vfcResourceUuidObjectNode,
- List<CldsVfcData> cldsVfcDataList) {
+ List<CldsVfcData> cldsVfcDataList) {
ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();
ObjectNode vfcObjectNode = mapper.createObjectNode();
ObjectNode alarmCondNode = mapper.createObjectNode();
@@ -1031,14 +951,14 @@ public class SdcCatalogServices { for (CldsVfcData currCldsVfcData : cldsVfcDataList) {
if (currCldsVfcData != null) {
if (currCldsVfcData.getCldsAlarmConditions() != null
- && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
+ && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
for (CldsAlarmCondition currCldsAlarmCondition : currCldsVfcData.getCldsAlarmConditions()) {
if ("alarmCondition".equalsIgnoreCase(currCldsAlarmCondition.getEventName())) {
alarmCondNode.put(currCldsAlarmCondition.getAlarmConditionKey(),
- currCldsAlarmCondition.getAlarmConditionKey());
+ currCldsAlarmCondition.getAlarmConditionKey());
} else {
alertDescNode.put(currCldsAlarmCondition.getAlarmConditionKey(),
- currCldsAlarmCondition.getAlarmConditionKey());
+ currCldsAlarmCondition.getAlarmConditionKey());
}
}
}
@@ -1058,7 +978,7 @@ public class SdcCatalogServices { /**
* Method to create vfc and kpi nodes inside vf node
- *
+ *
* @param mapper
* @param cldsVfDataList
* @return
@@ -1075,9 +995,9 @@ public class SdcCatalogServices { if (currCldsVfData.getCldsVfcs() != null && !currCldsVfData.getCldsVfcs().isEmpty()) {
for (CldsVfcData currCldsVfcData : currCldsVfData.getCldsVfcs()) {
if (currCldsVfcData.getCldsAlarmConditions() != null
- && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
+ && !currCldsVfcData.getCldsAlarmConditions().isEmpty()) {
vfcUuidNode.put(currCldsVfcData.getVfcInvariantResourceUUID(),
- currCldsVfcData.getVfcName());
+ currCldsVfcData.getVfcName());
}
}
} else {
@@ -1086,7 +1006,7 @@ public class SdcCatalogServices { if (currCldsVfData.getCldsKPIList() != null && !currCldsVfData.getCldsKPIList().isEmpty()) {
for (CldsVfKPIData currCldsVfKPIData : currCldsVfData.getCldsKPIList()) {
kpiObjectNode.put(currCldsVfKPIData.getThresholdValue(),
- currCldsVfKPIData.getThresholdValue());
+ currCldsVfKPIData.getThresholdValue());
}
} else {
kpiObjectNode.put("", "");
@@ -1106,41 +1026,6 @@ public class SdcCatalogServices { return vfUuidObjectNode;
}
- /**
- * This method searches the equivalent artifact UUID for a specific
- * artifactName in a SdcServiceDetail.
- *
- * @param cldsSdcServiceDetail
- * The SdcServiceDetail that will be analyzed
- * @param artifactName
- * The artifact name that will be searched
- * @return The artifact UUID found
- */
- public String getArtifactIdIfArtifactAlreadyExists(SdcServiceDetail cldsSdcServiceDetail, String artifactName) {
- String artifactUuid = null;
- boolean artifactExists = false;
- if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null
- && !cldsSdcServiceDetail.getResources().isEmpty()) {
- for (SdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {
- if (artifactExists) {
- break;
- }
- if (currCldsSdcResource != null && currCldsSdcResource.getArtifacts() != null
- && !currCldsSdcResource.getArtifacts().isEmpty()) {
- for (SdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {
- if (currCldsSdcArtifact != null && currCldsSdcArtifact.getArtifactName() != null
- && currCldsSdcArtifact.getArtifactName().equalsIgnoreCase(artifactName)) {
- artifactUuid = currCldsSdcArtifact.getArtifactUUID();
- artifactExists = true;
- break;
- }
- }
- }
- }
- }
- return artifactUuid;
- }
-
// To get all sdc VF/VFC Resources basic info.
private List<SdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {
String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);
@@ -1150,12 +1035,12 @@ public class SdcCatalogServices { }
private String getResourceUuidFromResourceInvariantUuid(String resourceInvariantUuid,
- List<SdcResourceBasicInfo> resourceInfoList) {
+ List<SdcResourceBasicInfo> resourceInfoList) {
String resourceUuid = null;
if (resourceInfoList != null && !resourceInfoList.isEmpty()) {
for (SdcResourceBasicInfo currResource : resourceInfoList) {
if (currResource != null && currResource.getInvariantUUID() != null && currResource.getUuid() != null
- && currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {
+ && currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {
resourceUuid = currResource.getUuid();
break;
}
@@ -1163,150 +1048,4 @@ public class SdcCatalogServices { }
return resourceUuid;
}
-
- // Method to get service invariant uuid from model properties.
- private String getServiceInvariantUuidFromProps(ModelProperties props) {
- String invariantUuid = "";
- Global globalProps = props.getGlobal();
- if (globalProps != null && globalProps.getService() != null) {
- invariantUuid = globalProps.getService();
- }
- return invariantUuid;
- }
-
- /**
- * This method upload the BluePrint to SDC.
- *
- * @param prop
- * The Clds model Properties
- * @param userid
- * The user id for SDC
- * @param sdcReqUrlsList
- * The list of SDC URL to try
- * @param formattedSdcReq
- * The blueprint to upload
- * @param formattedSdcLocationReq
- * THe location Blueprint to upload
- * @param artifactName
- * The artifact name from where we can get the Artifact UUID
- * @param locationArtifactName
- * The location artifact name from where we can get the Artifact
- * UUID
- * @throws GeneralSecurityException
- * In case of issues with the decryting the encrypted password
- * @throws DecoderException
- * In case of issues with the decoding of the Hex String
- */
- public void uploadToSdc(ModelProperties prop, String userid, List<String> sdcReqUrlsList, String formattedSdcReq,
- String formattedSdcLocationReq, String artifactName, String locationArtifactName)
- throws GeneralSecurityException, DecoderException {
- logger.info("userid=" + userid);
- String serviceInvariantUuid = getServiceInvariantUuidFromProps(prop);
- if (sdcReqUrlsList != null && !sdcReqUrlsList.isEmpty()) {
- for (String url : sdcReqUrlsList) {
- if (url != null) {
- String originalServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- logger.info("ServiceUUID used before upload in url:" + originalServiceUuid);
- String sdcServicesInformation = getSdcServicesInformation(originalServiceUuid);
- SdcServiceDetail cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,
- artifactName);
- // Upload artifacts to sdc
- String updateUrl = uploadedArtifactUuid != null ? url + "/" + uploadedArtifactUuid : url;
- String responseStr = uploadArtifactToSdc(prop, userid, updateUrl, formattedSdcReq);
- logger.info("value of sdc Response of uploading to sdc :" + responseStr);
- String updatedServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- if (!originalServiceUuid.equalsIgnoreCase(updatedServiceUuid)) {
- url = url.replace(originalServiceUuid, updatedServiceUuid);
- }
- logger.info("ServiceUUID used after upload in ulr:" + updatedServiceUuid);
- sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);
- cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,
- locationArtifactName);
- // To send location information also to sdc
- updateUrl = uploadedArtifactUuid != null ? url + "/" + uploadedArtifactUuid : url;
- responseStr = uploadArtifactToSdc(prop, userid, updateUrl, formattedSdcLocationReq);
- logger.info("value of sdc Response of uploading location to sdc :" + responseStr);
- }
- }
- }
- }
-
- /**
- * Method to delete blueprint and location json artifacts from sdc
- *
- * @param prop
- * @param userid
- * @param sdcReqUrlsList
- * @param artifactName
- * @param locationArtifactName
- * @throws GeneralSecurityException
- * @throws DecoderException
- */
- public void deleteArtifactsFromSdc(ModelProperties prop, String userid, List<String> sdcReqUrlsList,
- String artifactName, String locationArtifactName) throws GeneralSecurityException, DecoderException {
- String serviceInvariantUuid = getServiceInvariantUuidFromProps(prop);
- for (String url : sdcReqUrlsList) {
- String originalServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- logger.info("ServiceUUID used before deleting in url:" + originalServiceUuid);
- String sdcServicesInformation = getSdcServicesInformation(originalServiceUuid);
- SdcServiceDetail cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail, artifactName);
- String responseStr = deleteArtifact(userid, url, uploadedArtifactUuid);
- logger.info("value of sdc Response of deleting blueprint from sdc :" + responseStr);
- String updatedServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
- if (!originalServiceUuid.equalsIgnoreCase(updatedServiceUuid)) {
- url = url.replace(originalServiceUuid, updatedServiceUuid);
- }
- logger.info("ServiceUUID used after delete in ulr:" + updatedServiceUuid);
- sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);
- cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
- uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail, locationArtifactName);
- responseStr = deleteArtifact(userid, url, uploadedArtifactUuid);
- logger.info("value of sdc Response of deleting location json from sdc :" + responseStr);
- }
- }
-
- private String deleteArtifact(String userid, String url, String uploadedArtifactUuid) {
- try {
- String responseStr = "";
- if (uploadedArtifactUuid != null && !uploadedArtifactUuid.isEmpty()) {
- logger.info("userid=" + userid);
- String basicAuth = getSdcBasicAuth();
- String sdcXonapInstanceId = refProp.getStringValue("sdc.sdcX-InstanceID");
- url = url + "/" + uploadedArtifactUuid;
- URL urlObj = new URL(url);
- HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
- conn = utils.invoke(conn,"SDC", "deleteArtifact");
- conn.setDoOutput(true);
- conn.setRequestProperty(refProp.getStringValue(SDC_INSTANCE_ID_PROPERTY_NAME), sdcXonapInstanceId);
- conn.setRequestProperty(HttpHeaders.AUTHORIZATION, basicAuth);
- conn.setRequestProperty("USER_ID", userid);
- conn.setRequestMethod("DELETE");
- conn.setRequestProperty("charset", "utf-8");
- conn.setUseCaches(false);
- conn.setRequestProperty(refProp.getStringValue(SDC_REQUESTID_PROPERTY_NAME),
- LoggingUtils.getRequestId());
- boolean requestFailed = true;
- int responseCode = conn.getResponseCode();
- logger.info("responseCode=" + responseCode);
- if (responseCode == 200) {
- requestFailed = false;
- }
- responseStr = getResponse(conn);
- if (responseStr != null && requestFailed) {
- logger.error("requestFailed - responseStr=" + responseStr);
- utils.invokeReturn();
- throw new BadRequestException(responseStr);
- }
- }
- utils.invokeReturn();
- return responseStr;
- } catch (IOException | DecoderException | GeneralSecurityException e) {
- logger.error("Exception when attempting to communicate with SDC", e);
- utils.invokeReturn();
- throw new SdcCommunicationException("Exception when attempting to communicate with SDC", e);
- }
- }
}
diff --git a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java index bdb4dda5b..9acad94ab 100644 --- a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java +++ b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java @@ -18,16 +18,18 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.config; import com.fasterxml.jackson.databind.JsonNode; +import com.google.common.base.Splitter; import java.io.IOException; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.util.List; import org.apache.commons.io.IOUtils; import org.onap.clamp.clds.util.JacksonUtils; @@ -52,7 +54,7 @@ public class ClampProperties { * get property value. * * @param key - * The first key + * The first key * @return The string with the value */ public String getStringValue(String key) { @@ -60,13 +62,13 @@ public class ClampProperties { } /** - * get property value for a combo key (key1 + "." + key2). If not found just - * use key1. + * get property value for a combo key (key1 + "." + key2). If not found just use + * key1. * * @param key1 - * The first key + * The first key * @param key2 - * The second key after a dot + * The second key after a dot * @return The string with the value */ public String getStringValue(String key1, String key2) { @@ -82,49 +84,47 @@ public class ClampProperties { * clds-reference file will be used as a filename. * * @param key - * The key that will be used to access the clds-reference file + * The key that will be used to access the clds-reference file * @return A jsonNode * @throws IOException - * In case of issues with the JSON parser + * In case of issues with the JSON parser */ public JsonNode getJsonTemplate(String key) throws IOException { String fileReference = getStringValue(key); return (fileReference != null) - ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference), - JsonNode.class) - : null; + ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference), JsonNode.class) + : null; } /** - * Return json as objects that can be updated. First try with combo key - * (key1 + "." + key2), otherwise default to just key1. The value obtained - * from the clds-reference file will be used as a filename. + * Return json as objects that can be updated. First try with combo key (key1 + + * "." + key2), otherwise default to just key1. The value obtained from the + * clds-reference file will be used as a filename. * * @param key1 - * The first key + * The first key * @param key2 - * The second key after a dot + * The second key after a dot * @return A JsonNode * @throws IOException - * In case of issues with the JSON parser + * In case of issues with the JSON parser */ public JsonNode getJsonTemplate(String key1, String key2) throws IOException { String fileReference = getStringValue(key1, key2); return (fileReference != null) - ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference), - JsonNode.class) - : null; + ? JacksonUtils.getObjectMapperInstance().readValue(getFileContentFromPath(fileReference), JsonNode.class) + : null; } /** - * Return the file content. The value obtained from the clds-reference file - * will be used as a filename. + * Return the file content. The value obtained from the clds-reference file will + * be used as a filename. * * @param key - * The key that will be used to access the clds-reference file + * The key that will be used to access the clds-reference file * @return File content in String * @throws IOException - * In case of issues with the JSON parser + * In case of issues with the JSON parser */ public String getFileContent(String key) throws IOException { String fileReference = getStringValue(key); @@ -133,16 +133,16 @@ public class ClampProperties { /** * Return the file content. First try with combo key (key1 + "." + key2), - * otherwise default to just key1. The value obtained from the - * clds-reference file will be used as a filename. + * otherwise default to just key1. The value obtained from the clds-reference + * file will be used as a filename. * * @param key1 - * The first key + * The first key * @param key2 - * The second key after a dot + * The second key after a dot * @return File content in String * @throws IOException - * In case of issues with the JSON parser + * In case of issues with the JSON parser */ public String getFileContent(String key1, String key2) throws IOException { String fileReference = getStringValue(key1, key2); @@ -153,4 +153,18 @@ public class ClampProperties { URL url = appContext.getResource(filepath).getURL(); return IOUtils.toString(url, StandardCharsets.UTF_8); } + + /** + * + * + * @param key + * property key + * @param separator + * property value separator + * @return List of Strings split with a separator + */ + public List<String> getStringList(String key, String separator) { + return Splitter.on(separator).trimResults().omitEmptyStrings() + .splitToList(env.getProperty(CONFIG_PREFIX + key)); + } } diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java index 055847085..1fb86c0ce 100644 --- a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java @@ -5,20 +5,20 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.config.spring; @@ -61,7 +61,7 @@ public class CldsSdcControllerConfiguration { SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration(); sdcControllersConfig.getAllDefinedControllers().forEach((k, v) -> { logger.info("Creating controller instance:" + k); - SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, v, true); + SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, v, null); sdcControllersList.add(sdcController); }); } diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java index 121114b37..b6e27c5e1 100644 --- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java +++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java @@ -29,13 +29,9 @@ import com.att.eelf.configuration.EELFManager; import java.io.InputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; import javax.sql.DataSource; @@ -515,32 +511,34 @@ public class CldsDao { private List<CldsToscaModel> getToscaModel(String toscaModelName, String policyType) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); List<CldsToscaModel> cldsToscaModels = new ArrayList<>(); - MapSqlParameterSource params = new MapSqlParameterSource(); - String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp, tmr.tosca_model_yaml FROM tosca_model tm, tosca_model_revision tmr WHERE tm.tosca_model_id = tmr.tosca_model_id "; - if (toscaModelName != null) { - toscaModelSql += " AND tm.tosca_model_name = :toscaModelName"; - params.addValue("toscaModelName", toscaModelName); - } - if (policyType != null) { - toscaModelSql += " AND tm.policy_type = :policyType"; - params.addValue("policyType", policyType); - } - toscaModelSql += " AND tmr.version = (select max(version) from tosca_model_revision st where tmr.tosca_model_id=st.tosca_model_id)"; + String toscaModelSql = "SELECT tm.tosca_model_name, tm.tosca_model_id, tm.policy_type, tmr.tosca_model_revision_id, tmr.tosca_model_json, tmr.version, tmr.user_id, tmr.createdTimestamp, tmr.lastUpdatedTimestamp " + + ((toscaModelName != null) ? (", tmr.tosca_model_yaml ") : " ") + + "FROM tosca_model tm, tosca_model_revision tmr WHERE tm.tosca_model_id = tmr.tosca_model_id " + + ((toscaModelName != null) ? (" AND tm.tosca_model_name = '" + toscaModelName + "'") : " ") + + ((policyType != null) ? (" AND tm.policy_type = '" + policyType + "'") : " ") + + "AND tmr.version = (select max(version) from tosca_model_revision st where tmr.tosca_model_id=st.tosca_model_id)"; + + List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(toscaModelSql); - Optional.ofNullable(jdbcTemplateObject.queryForList(toscaModelSql, params)).orElse(Collections.emptyList()) - .forEach(row -> { + if (rows != null) { + rows.forEach(row -> { CldsToscaModel cldsToscaModel = new CldsToscaModel(); cldsToscaModel.setId((String) row.get("tosca_model_id")); cldsToscaModel.setPolicyType((String) row.get("policy_type")); cldsToscaModel.setToscaModelName((String) row.get("tosca_model_name")); cldsToscaModel.setUserId((String) row.get("user_id")); cldsToscaModel.setRevisionId((String) row.get("tosca_model_revision_id")); + cldsToscaModel.setToscaModelJson((String) row.get("tosca_model_json")); cldsToscaModel.setVersion(((Double) row.get("version"))); cldsToscaModel.setCreatedDate(sdf.format(row.get("createdTimestamp"))); - cldsToscaModel.setToscaModelYaml((String) row.get("tosca_model_yaml")); + cldsToscaModel.setLastUpdatedDate(sdf.format(row.get("lastUpdatedTimestamp"))); + if (toscaModelName != null) { + cldsToscaModel.setToscaModelYaml((String) row.get("tosca_model_yaml")); + } cldsToscaModels.add(cldsToscaModel); }); + } return cldsToscaModels; } @@ -604,11 +602,10 @@ public class CldsDao { * @param userId */ public void updateDictionary(String dictionaryId, CldsDictionary cldsDictionary, String userId) { - String dictionarySql = "UPDATE dictionary SET dictionary_name = :dictionary_name, modified_by = :modified_by WHERE dictionary_id = :dictionary_id"; - SqlParameterSource namedParameters = new MapSqlParameterSource() - .addValue("dictionary_name", cldsDictionary.getDictionaryName()).addValue("modified_by", userId) - .addValue("dictionary_id", dictionaryId); - jdbcTemplateObject.update(dictionarySql, namedParameters); + + String dictionarySql = "UPDATE dictionary " + "SET dictionary_name = '" + cldsDictionary.getDictionaryName() + + "', modified_by = '" + userId + "'" + "WHERE dictionary_id = '" + dictionaryId + "'"; + jdbcTemplateObject.update(dictionarySql); cldsDictionary.setUpdatedBy(userId); } @@ -622,16 +619,17 @@ public class CldsDao { public List<CldsDictionary> getDictionary(String dictionaryId, String dictionaryName) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); List<CldsDictionary> dictionaries = new ArrayList<>(); - String dictionarySql = "SELECT dictionary_id, dictionary_name, created_by, modified_by, timestamp FROM dictionary WHERE "; - MapSqlParameterSource namedParameters = new MapSqlParameterSource(); - Optional.ofNullable(dictionaryName).ifPresent(dn -> namedParameters.addValue("dictionary_name", dn)); - Optional.ofNullable(dictionaryId).ifPresent(dn -> namedParameters.addValue("dictionary_id", dn)); - dictionarySql += Optional.ofNullable(namedParameters.getParameterNames()).filter(a -> a.length > 0) - .map(Arrays::stream).map(s -> s.map(param -> param + " = :" + param).collect(Collectors.joining(" AND "))) - .orElse("1"); - - Optional.ofNullable(jdbcTemplateObject.queryForList(dictionarySql, namedParameters)) - .orElse(Collections.emptyList()).forEach(row -> { + String dictionarySql = "SELECT dictionary_id, dictionary_name, created_by, modified_by, timestamp FROM dictionary" + + ((dictionaryId != null || dictionaryName != null) + ? (" WHERE " + ((dictionaryName != null) ? ("dictionary_name = '" + dictionaryName + "'") : "") + + ((dictionaryId != null && dictionaryName != null) ? (" AND ") : "") + + ((dictionaryId != null) ? ("dictionary_id = '" + dictionaryId + "'") : "")) + : ""); + + List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql); + + if (rows != null) { + rows.forEach(row -> { CldsDictionary cldsDictionary = new CldsDictionary(); cldsDictionary.setDictionaryId((String) row.get("dictionary_id")); cldsDictionary.setDictionaryName((String) row.get("dictionary_name")); @@ -640,6 +638,7 @@ public class CldsDao { cldsDictionary.setLastUpdatedDate(sdf.format(row.get("timestamp"))); dictionaries.add(cldsDictionary); }); + } return dictionaries; } @@ -671,14 +670,13 @@ public class CldsDao { public void updateDictionaryElements(String dictionaryElementId, CldsDictionaryItem cldsDictionaryItem, String userId) { - String dictionarySql = "UPDATE dictionary_elements SET dict_element_name = :dict_element_name, dict_element_short_name = :dict_element_short_name, dict_element_description = :dict_element_description,dict_element_type=:dict_element_type, modified_by = :modified_by WHERE dict_element_id = :dict_element_id"; - SqlParameterSource namedParameters = new MapSqlParameterSource() - .addValue("dict_element_name", cldsDictionaryItem.getDictElementName()) - .addValue("dict_element_short_name", cldsDictionaryItem.getDictElementShortName()) - .addValue("dict_element_description", cldsDictionaryItem.getDictElementDesc()) - .addValue("dict_element_type", cldsDictionaryItem.getDictElementType()).addValue("modified_by", userId) - .addValue("dict_element_id", dictionaryElementId); - jdbcTemplateObject.update(dictionarySql, namedParameters); + String dictionarySql = "UPDATE dictionary_elements SET dict_element_name = '" + + cldsDictionaryItem.getDictElementName() + "', dict_element_short_name = '" + + cldsDictionaryItem.getDictElementShortName() + "', dict_element_description= '" + + cldsDictionaryItem.getDictElementDesc() + "', dict_element_type = '" + + cldsDictionaryItem.getDictElementType() + "', modified_by = '" + userId + "' " + + "WHERE dict_element_id = '" + dictionaryElementId + "'"; + jdbcTemplateObject.update(dictionarySql); cldsDictionaryItem.setUpdatedBy(userId); } @@ -695,24 +693,17 @@ public class CldsDao { String dictElementShortName) { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); List<CldsDictionaryItem> dictionaryItems = new ArrayList<>(); - MapSqlParameterSource namedParameters = new MapSqlParameterSource(); String dictionarySql = "SELECT de.dict_element_id, de.dictionary_id, de.dict_element_name, de.dict_element_short_name, de.dict_element_description, de.dict_element_type, de.created_by, de.modified_by, de.timestamp " - + "FROM dictionary_elements de, dictionary d WHERE de.dictionary_id = d.dictionary_id "; - if (dictionaryId != null) { - dictionarySql += " AND d.dictionary_id = :dictionaryId"; - namedParameters.addValue("dictionaryId", dictionaryId); - } - if (dictElementShortName != null) { - dictionarySql += " AND de.dict_element_short_name = :dictElementShortName"; - namedParameters.addValue("dictElementShortName", dictElementShortName); - } - if (dictionaryName != null) { - dictionarySql += " AND dictionary_name = :dictionaryName"; - namedParameters.addValue("dictionaryName", dictionaryName); - } + + "FROM dictionary_elements de, dictionary d WHERE de.dictionary_id = d.dictionary_id " + + ((dictionaryId != null) ? (" AND d.dictionary_id = '" + dictionaryId + "'") : "") + + ((dictElementShortName != null) ? (" AND de.dict_element_short_name = '" + dictElementShortName + "'") + : "") + + ((dictionaryName != null) ? (" AND dictionary_name = '" + dictionaryName + "'") : ""); - Optional.ofNullable(jdbcTemplateObject.queryForList(dictionarySql, namedParameters)) - .orElse(Collections.emptyList()).forEach(row -> { + List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql); + + if (rows != null) { + rows.forEach(row -> { CldsDictionaryItem dictionaryItem = new CldsDictionaryItem(); dictionaryItem.setDictElementId((String) row.get("dict_element_id")); dictionaryItem.setDictionaryId((String) row.get("dictionary_id")); @@ -725,6 +716,30 @@ public class CldsDao { dictionaryItem.setLastUpdatedDate(sdf.format(row.get("timestamp"))); dictionaryItems.add(dictionaryItem); }); + } + return dictionaryItems; + } + + /** + * Method to get Map of all dictionary elements with key as dictionary short + * name and value as the full name + * + * @param dictionaryElementType + * @return Map of dictionary elements as key value pair + */ + public Map<String, String> getDictionaryElementsByType(String dictionaryElementType) { + Map<String, String> dictionaryItems = new HashMap<>(); + String dictionarySql = "SELECT dict_element_name, dict_element_short_name " + "FROM dictionary_elements " + + "WHERE dict_element_type = '" + dictionaryElementType + "'"; + + List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(dictionarySql); + + if (rows != null) { + rows.forEach(row -> { + dictionaryItems.put(((String) row.get("dict_element_short_name")), + ((String) row.get("dict_element_name"))); + }); + } return dictionaryItems; } } diff --git a/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java new file mode 100644 index 000000000..c6b0d5556 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.exception; + +/** + * New exception to request errors. + * + */ +public class BadRequestException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = -5738167530541646123L; + + /** + * This constructor can be used to create a new CldsConfigException. + * + * @param message + * A string message detailing the problem + * @param e + * The exception sent by the code + */ + public BadRequestException(String message, Throwable e) { + super(message, e); + } + + /** + * This constructor can be used to create a new CldsConfigException. Use this + * constructor only if you are creating a new exception stack, not if an + * exception was already raised by another code. + * + * @param message + * A string message detailing the problem + */ + public BadRequestException(String message) { + super(message); + } + +} diff --git a/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java new file mode 100644 index 000000000..4ea050392 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.exception; + +/** + * New exception to request errors. + * + */ +public class NotAuthorizedException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = -5738167530541646123L; + + /** + * This constructor can be used to create a new CldsConfigException. + * + * @param message + * A string message detailing the problem + * @param e + * The exception sent by the code + */ + public NotAuthorizedException(String message, Throwable e) { + super(message, e); + } + + /** + * This constructor can be used to create a new CldsConfigException. Use this + * constructor only if you are creating a new exception stack, not if an + * exception was already raised by another code. + * + * @param message + * A string message detailing the problem + */ + public NotAuthorizedException(String message) { + super(message); + } + +} diff --git a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java index 90dc996cc..b993c6376 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsEvent.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsEvent.java @@ -31,6 +31,7 @@ import org.onap.clamp.clds.dao.CldsDao; public class CldsEvent { public static final String ACTION_TEST = "TEST"; public static final String ACTION_CREATE = "CREATE"; + public static final String ACTION_MODIFY = "MODIFY"; public static final String ACTION_SUBMIT = "SUBMIT"; // an update before model is active public static final String ACTION_RESUBMIT = "RESUBMIT"; diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java index 14fe44390..2c178eb8b 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java @@ -25,18 +25,18 @@ package org.onap.clamp.clds.model; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.fasterxml.jackson.databind.JsonNode; -import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import javax.ws.rs.BadRequestException; import javax.ws.rs.NotFoundException; import org.onap.clamp.clds.dao.CldsDao; -import org.onap.clamp.clds.util.JacksonUtils; +import org.onap.clamp.clds.model.actions.ActionsHandler; +import org.onap.clamp.clds.model.actions.ActionsHandlerImpl; +import org.onap.clamp.clds.model.status.StatusHandler; +import org.onap.clamp.clds.model.status.StatusHandlerImpl; /** * Represent a CLDS Model. @@ -77,6 +77,18 @@ public class CldsModel { private String deploymentId; private String deploymentStatusUrl; + // Set default handlers but this can be changed if needed. + private static StatusHandler statusHandler = new StatusHandlerImpl(); + private static ActionsHandler actionsHandler = new ActionsHandlerImpl(); + + public static synchronized void setStatusHandler(StatusHandler statHandler) { + statusHandler = statHandler; + } + + public static synchronized void setActionsHandler(ActionsHandler cdHandler) { + actionsHandler = cdHandler; + } + /** * Construct empty model. */ @@ -122,54 +134,7 @@ public class CldsModel { * set the status in the model */ public void determineStatus() { - status = STATUS_UNKNOWN; - if (event == null || event.getActionCd() == null) { - status = STATUS_DESIGN; - } else if (event.isActionStateCd(CldsEvent.ACTION_STATE_ERROR)) { - status = STATUS_ERROR; - } else if (event.isActionAndStateCd(CldsEvent.ACTION_CREATE, CldsEvent.ACTION_STATE_ANY)) { - status = STATUS_DESIGN; - } else if (event.isActionAndStateCd(CldsEvent.ACTION_DISTRIBUTE, CldsEvent.ACTION_STATE_RECEIVED) - || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_COMPLETED) - || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_COMPLETED) - || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_COMPLETED)) { - status = STATUS_DISTRIBUTED; - } else if (event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_SENT)) { - status = STATUS_DELETING; - } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_COMPLETED) - || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED) - || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_COMPLETED) - || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) { - status = STATUS_ACTIVE; - } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_COMPLETED)) { - status = STATUS_STOPPED; - } - } - - /** - * Get the actionCd from current event. If none, default value is - * CldsEvent.ACTION_CREATE - */ - private String getCurrentActionCd() { - // current default actionCd is CREATE - String actionCd = CldsEvent.ACTION_CREATE; - if (event != null && event.getActionCd() != null) { - actionCd = event.getActionCd(); - } - return actionCd; - } - - /** - * Get the actionStateCd from current event. If none, default value is - * CldsEvent.ACTION_STATE_COMPLETED - */ - private String getCurrentActionStateCd() { - // current default actionStateCd is CREATE - String actionStateCd = CldsEvent.ACTION_STATE_COMPLETED; - if (event != null && event.getActionStateCd() != null) { - actionStateCd = event.getActionStateCd(); - } - return actionStateCd; + status = statusHandler.determineStatusOnLastEvent(event); } /** @@ -179,94 +144,7 @@ public class CldsModel { * the first one. */ public void determinePermittedActionCd() { - String actionCd = getCurrentActionCd(); - switch (actionCd) { - case CldsEvent.ACTION_CREATE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE); - if (isSimplifiedModel()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY, - CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE); - } - break; - case CldsEvent.ACTION_SUBMIT: - case CldsEvent.ACTION_RESUBMIT: - case CldsEvent.ACTION_DISTRIBUTE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT, - CldsEvent.ACTION_DELETE); - if (isSimplifiedModel()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE, - CldsEvent.ACTION_DELETE); - } - break; - case CldsEvent.ACTION_SUBMITDCAE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); - break; - case CldsEvent.ACTION_SUBMITPOLICY: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); - break; - case CldsEvent.ACTION_UNDEPLOY: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, - CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); - if (isSimplifiedModel()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, - CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); - } - break; - case CldsEvent.ACTION_DEPLOY: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE, - CldsEvent.ACTION_STOP); - break; - case CldsEvent.ACTION_RESTART: - case CldsEvent.ACTION_UPDATE: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP, - CldsEvent.ACTION_UNDEPLOY); - if (isPolicyOnly()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); - } - break; - case CldsEvent.ACTION_STOP: - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART, - CldsEvent.ACTION_UNDEPLOY); - if (isPolicyOnly()) { - permittedActionCd = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART, - CldsEvent.ACTION_DELETE); - } - break; - default: - logger.warn("Invalid current actionCd: " + actionCd); - } - } - - private boolean isSimplifiedModel() { - boolean result = false; - try { - if (propText != null) { - JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText); - JsonNode simpleModelJson = modelJson.get("simpleModel"); - if (simpleModelJson != null && simpleModelJson.asBoolean()) { - result = true; - } - } - } catch (IOException e) { - logger.error("Error while parsing propText json", e); - } - return result; - } - - private boolean isPolicyOnly() { - boolean result = false; - try { - if (propText != null) { - JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText); - JsonNode policyOnlyJson = modelJson.get("policyOnly"); - if (policyOnlyJson != null && policyOnlyJson.asBoolean()) { - result = true; - } - } - } catch (IOException e) { - logger.error("Error while parsing propText json", e); - } - return result; + permittedActionCd = actionsHandler.determinePermittedActionsOnLastEvent(event, propText); } /** @@ -278,8 +156,8 @@ public class CldsModel { determinePermittedActionCd(); if (!permittedActionCd.contains(requestedActionCd)) { throw new IllegalArgumentException( - "Invalid requestedActionCd: " + requestedActionCd + ". Given current actionCd: " + getCurrentActionCd() - + ", the permittedActionCd: " + permittedActionCd); + "Invalid requestedActionCd: " + requestedActionCd + ". Given current actionCd: " + + actionsHandler.getCurrentActionCd(event) + ", the permittedActionCd: " + permittedActionCd); } } diff --git a/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java index 000363d5c..eb05fe406 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java @@ -29,6 +29,7 @@ package org.onap.clamp.clds.model; public class CldsMonitoringDetails { private String closeloopName; + private String modelId; private String modelName; private String serviceTypeId; private String deploymentId; @@ -45,6 +46,14 @@ public class CldsMonitoringDetails { this.closeloopName = closeloopName; } + public String getModelId() { + return modelId; + } + + public void setModelId(String modelId) { + this.modelId = modelId; + } + public String getModelName() { return modelName; } @@ -84,7 +93,7 @@ public class CldsMonitoringDetails { public void setAction(String action) { this.action = action; } - + public String getUserid() { return userid; } @@ -92,9 +101,9 @@ public class CldsMonitoringDetails { public void setUserid(String userid) { this.userid = userid; } - + public String getTimestamp() { - return timestamp; + return timestamp; } public void setTimestamp(String time) { diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java index 4a2352527..25b8d4016 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java @@ -25,7 +25,11 @@ package org.onap.clamp.clds.model; import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.onap.clamp.clds.client.req.policy.PolicyClient; +import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.dao.CldsDao; +import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor; public class CldsToscaModel extends CldsToscaModelRevision { @@ -40,22 +44,31 @@ public class CldsToscaModel extends CldsToscaModelRevision { * @param cldsDao * @param userId */ - public CldsToscaModel save(CldsDao cldsDao, String userId) { + public CldsToscaModel save(CldsDao cldsDao, ClampProperties refProp, PolicyClient policyClient, String userId) { CldsToscaModel cldsToscaModel = null; - // TODO tosca parsing logic - this.setToscaModelJson("{}"); - this.setPolicyType("Aging");// TODO update with subString or node_type from the model name + refProp.getStringList("tosca.policyTypes", ",").stream().forEach(policyType -> { + if (StringUtils.containsIgnoreCase(this.getToscaModelName(), policyType)) { + this.setPolicyType(policyType); + } + }); + + ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(cldsDao); + this.setToscaModelJson(convertor.parseToscaYaml(this.getToscaModelYaml())); List<CldsToscaModel> toscaModels = cldsDao.getToscaModelByName(this.getToscaModelName()); if (toscaModels != null && !toscaModels.isEmpty()) { CldsToscaModel toscaModel = toscaModels.stream().findFirst().get(); - // CldsToscaModelRevision modelRevision = - // revisions.stream().max(Comparator.comparingDouble(CldsToscaModelRevision::getVersion)).get(); this.setVersion(incrementVersion(toscaModel.getVersion())); this.setId(toscaModel.getId()); this.setUserId(userId); + if (refProp.getStringValue("import.tosca.model").equalsIgnoreCase("true")) { + policyClient.importToscaModel(this); + } cldsToscaModel = cldsDao.updateToscaModelWithNewVersion(this, userId); } else { this.setVersion(1); + if (refProp.getStringValue("import.tosca.model").equalsIgnoreCase("true")) { + policyClient.importToscaModel(this); + } cldsToscaModel = cldsDao.insToscaModel(this, userId); } return cldsToscaModel; diff --git a/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java new file mode 100644 index 000000000..1c54dae01 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandler.java @@ -0,0 +1,169 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.model.actions; + +import com.att.eelf.configuration.EELFLogger; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import org.onap.clamp.clds.model.CldsEvent; +import org.onap.clamp.clds.util.JacksonUtils; + +/** + * Interface for actions that the user can do according to the last event. + * + * + */ +public interface ActionsHandler { + + enum ModelType { + SIMPLE_MODEL("simpleModel"), POLICY_MODEL("policyModel"); + private final String type; + + private ModelType(String type) { + this.type = type; + } + + public final String getType() { + return this.type; + } + } + + public EELFLogger getLogger(); + + /** + * This method determines a list of actions that the user can do according to + * the last event. + * + * @param event + * The last event + * @param propText + * The Json properties string + * @return A list of actions + */ + default List<String> determinePermittedActionsOnLastEvent(CldsEvent event, String propText) { + List<String> permittedActions; + String actionCd = getCurrentActionCd(event); + switch (actionCd) { + case CldsEvent.ACTION_CREATE: + permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE); + if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) { + permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_SUBMITPOLICY, + CldsEvent.ACTION_TEST, CldsEvent.ACTION_DELETE); + } + break; + case CldsEvent.ACTION_SUBMIT: + case CldsEvent.ACTION_RESUBMIT: + case CldsEvent.ACTION_DISTRIBUTE: + permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_RESUBMIT, + CldsEvent.ACTION_DELETE); + if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) { + permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_SUBMITDCAE, + CldsEvent.ACTION_DELETE); + } + break; + case CldsEvent.ACTION_SUBMITDCAE: + permittedActions = Arrays.asList(CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); + break; + case CldsEvent.ACTION_SUBMITPOLICY: + permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); + break; + case CldsEvent.ACTION_UNDEPLOY: + permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, + CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_DELETE); + if (isTypeModel(propText, ModelType.SIMPLE_MODEL)) { + permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_DEPLOY, + CldsEvent.ACTION_SUBMITDCAE, CldsEvent.ACTION_DELETE); + } + break; + case CldsEvent.ACTION_DEPLOY: + permittedActions = Arrays.asList(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); + break; + case CldsEvent.ACTION_RESTART: + case CldsEvent.ACTION_UPDATE: + permittedActions = Arrays.asList(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP, + CldsEvent.ACTION_UNDEPLOY); + if (isTypeModel(propText, ModelType.POLICY_MODEL)) { + permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STOP); + } + break; + case CldsEvent.ACTION_STOP: + permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART, + CldsEvent.ACTION_UNDEPLOY); + if (isTypeModel(propText, ModelType.POLICY_MODEL)) { + permittedActions = Arrays.asList(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_RESTART, + CldsEvent.ACTION_DELETE); + } + break; + default: + getLogger().warn("Invalid current actionCd: " + actionCd); + permittedActions = Arrays.asList(); + } + return permittedActions; + } + + /** + * This method returns the action of the event or a default one if not found. + * + * @param event + * The last event + * @return The action + */ + default String getCurrentActionCd(CldsEvent event) { + // current default actionCd is CREATE + String actionCd = CldsEvent.ACTION_CREATE; + if (event != null && event.getActionCd() != null) { + actionCd = event.getActionCd(); + } + return actionCd; + } + + /** + * Check whether the text properties is of specified type ModelType. + * + * @param propText + * The Clamp Json properties + * @param key + * The model type + * @return True if matches the right type specified + */ + default boolean isTypeModel(String propText, ModelType key) { + boolean result = false; + try { + if (propText != null) { + JsonNode modelJson = JacksonUtils.getObjectMapperInstance().readTree(propText); + JsonNode modelJsonOfType = modelJson.get(key.getType()); + if (modelJsonOfType != null && modelJsonOfType.asBoolean()) { + result = true; + } + } + } catch (IOException e) { + getLogger().error("Error while parsing propText json", e); + } + return result; + } +} diff --git a/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java new file mode 100644 index 000000000..8d7d24089 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/actions/ActionsHandlerImpl.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.model.actions; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class ActionsHandlerImpl implements ActionsHandler { + + private static final EELFLogger logger = EELFManager.getInstance().getLogger(ActionsHandlerImpl.class); + + @Override + public EELFLogger getLogger() { + return logger; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java index 6bf4194bd..571e5b1bc 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java @@ -18,7 +18,7 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.model.properties; @@ -50,8 +50,8 @@ public abstract class AbstractModelElement { private static final String LOG_ELEMENT_NOT_FOUND_IN_JSON = "Value '{}' for key 'name' not found in JSON {}"; /** - * Perform base parsing of properties for a ModelElement (such as, - * VesCollector, Policy and Tca) + * Perform base parsing of properties for a ModelElement (such as, VesCollector, + * Policy and Tca) */ protected AbstractModelElement(String type, ModelProperties modelProp, ModelBpmn modelBpmn, JsonNode modelJson) { this.type = type; @@ -63,23 +63,6 @@ public abstract class AbstractModelElement { } /** - * topicSubscribes is the topicPublishes of the from Model Element (the - * previous one in the chain). - * - * @return the topicSubscribes - */ - public String getTopicSubscribes() { - // get fromId for this type - String fromId = modelBpmn.getFromId(type); - // find the type of the from model element - String fromType = modelBpmn.getType(fromId); - // get the model element for the type - AbstractModelElement me = modelProp.getModelElementByType(fromType); - // get the topic publishes for the model element - return me.topicPublishes; - } - - /** * @return the topicPublishes */ public String getTopicPublishes() { @@ -87,8 +70,8 @@ public abstract class AbstractModelElement { } /** - * Return the value field of the json node element that has a name field - * equals to the given name. + * Return the value field of the json node element that has a name field equals + * to the given name. */ public static String getValueByName(JsonNode nodeIn, String name) { String value = null; @@ -115,8 +98,8 @@ public abstract class AbstractModelElement { } /** - * Return the Json value field of the json node element that has a name - * field equals to the given name. + * Return the Json value field of the json node element that has a name field + * equals to the given name. */ public static JsonNode getJsonNodeByName(JsonNode nodeIn, String name) { JsonNode vnode = null; @@ -136,8 +119,8 @@ public abstract class AbstractModelElement { } /** - * Return the value field of the json node element that has a name field - * that equals the given name. + * Return the value field of the json node element that has a name field that + * equals the given name. */ public static String getNodeValueByName(JsonNode nodeIn, String name) { String value = null; @@ -153,8 +136,8 @@ public abstract class AbstractModelElement { } /** - * Return the value field of the json node element that has a name field - * that equals the given name. + * Return the value field of the json node element that has a name field that + * equals the given name. */ public static List<String> getNodeValuesByName(JsonNode nodeIn, String name) { List<String> values = new ArrayList<>(); @@ -185,8 +168,8 @@ public abstract class AbstractModelElement { } /** - * Return an array of values for the field of the json node element that has - * a name field equals to the given name. + * Return an array of values for the field of the json node element that has a + * name field equals to the given name. */ public static List<String> getValuesByName(JsonNode nodeIn, String name) { List<String> values = null; @@ -221,8 +204,8 @@ public abstract class AbstractModelElement { } /** - * Return the value field of the json node element that has a name field - * equals to the given name. + * Return the value field of the json node element that has a name field equals + * to the given name. */ public String getValueByName(String name) { return getValueByName(modelElementJsonNode, name); @@ -237,8 +220,8 @@ public abstract class AbstractModelElement { } /** - * Return an array of values for the field of the json node element that has - * a name field equals to the given name. + * Return an array of values for the field of the json node element that has a + * name field equals to the given name. */ public List<String> getValuesByName(String name) { return getValuesByName(modelElementJsonNode, name); diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Global.java b/src/main/java/org/onap/clamp/clds/model/properties/Global.java index 6fabc7a51..e86740726 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/Global.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Global.java @@ -47,6 +47,7 @@ public class Global { private List<String> resourceVfc; private JsonNode deployParameters; private List<String> location; + private String vnfScope; /** * Parse global given json node. @@ -61,6 +62,7 @@ public class Global { resourceVfc = AbstractModelElement.getValuesByName(globalNode, "vfc"); deployParameters = AbstractModelElement.getJsonNodeByName(globalNode, "deployParameters"); location = AbstractModelElement.getValuesByName(globalNode, "location"); + vnfScope = AbstractModelElement.getValueByName(globalNode, "vnf"); } /** @@ -141,4 +143,9 @@ public class Global { public void setDeployParameters(JsonNode deployParameters) { this.deployParameters = deployParameters; } + + public String getVnfScope() { + return vnfScope; + } + } diff --git a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java index f38e8c1c4..3d7bbcc3a 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java @@ -39,7 +39,6 @@ import org.apache.camel.Exchange; import org.onap.clamp.clds.client.req.policy.PolicyClient; import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.exception.ModelBpmnException; -import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.service.CldsService; import org.onap.clamp.clds.util.JacksonUtils; @@ -75,22 +74,22 @@ public class ModelProperties { } /** - * Retain data required to parse the ModelElement objects. (Rather than - * parse them all - parse them on demand if requested.) + * Retain data required to parse the ModelElement objects. (Rather than parse + * them all - parse them on demand if requested.) * * @param modelName - * The model name coming form the UI + * The model name coming form the UI * @param controlName - * The closed loop name coming from the UI + * The closed loop name coming from the UI * @param actionCd - * Type of operation PUT,UPDATE,DELETE + * Type of operation PUT,UPDATE,DELETE * @param isATest - * The test flag coming from the UI (for validation only, no - * query are physically executed) + * The test flag coming from the UI (for validation only, no query are + * physically executed) * @param modelBpmnText - * The BPMN flow in JSON from the UI + * The BPMN flow in JSON from the UI * @param modelPropText - * The BPMN parameters for all boxes defined in modelBpmnTest + * The BPMN parameters for all boxes defined in modelBpmnTest */ public ModelProperties(String modelName, String controlName, String actionCd, boolean isATest, String modelBpmnText, String modelPropText) { @@ -108,10 +107,10 @@ public class ModelProperties { } /** - * This method is meant to ensure that one ModelElement instance exists for - * each ModelElement class. As new ModelElement classes could have been - * registered after instantiation of this ModelProperties, we need to build - * the missing ModelElement instances. + * This method is meant to ensure that one ModelElement instance exists for each + * ModelElement class. As new ModelElement classes could have been registered + * after instantiation of this ModelProperties, we need to build the missing + * ModelElement instances. */ private final void instantiateMissingModelElements() { if (modelElementClasses.size() != modelElements.size()) { @@ -120,19 +119,18 @@ public class ModelProperties { // Parse the list of base Model Elements and build up the // ModelElements modelElementClasses.entrySet().stream().parallel() - .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey()) - && missingTypes.contains(entry.getValue()))) - .forEach(entry -> { - try { - modelElements.put(entry.getValue(), - (entry.getKey() - .getConstructor(ModelProperties.class, ModelBpmn.class, JsonNode.class) - .newInstance(this, modelBpmn, modelJson))); - } catch (InstantiationException | NoSuchMethodException | IllegalAccessException - | InvocationTargetException e) { - logger.warn("Unable to instantiate a ModelElement, exception follows: ", e); - } - }); + .filter(entry -> (AbstractModelElement.class.isAssignableFrom(entry.getKey()) + && missingTypes.contains(entry.getValue()))) + .forEach(entry -> { + try { + modelElements.put(entry.getValue(), + (entry.getKey().getConstructor(ModelProperties.class, ModelBpmn.class, JsonNode.class) + .newInstance(this, modelBpmn, modelJson))); + } catch (InstantiationException | NoSuchMethodException | IllegalAccessException + | InvocationTargetException e) { + logger.warn("Unable to instantiate a ModelElement, exception follows: ", e); + } + }); } } @@ -162,10 +160,9 @@ public class ModelProperties { * Create ModelProperties extracted from a CamelExchange. * * @param camelExchange - * The camel Exchange object that contains all info provided to - * the flow - * @return A model Properties created from the parameters found in - * camelExchange object + * The camel Exchange object that contains all info provided to the flow + * @return A model Properties created from the parameters found in camelExchange + * object */ public static ModelProperties create(Exchange camelExchange) { String modelProp = (String) camelExchange.getProperty("modelProp"); @@ -178,20 +175,6 @@ public class ModelProperties { } /** - * return appropriate model element given the type - * - * @param type - * @return - */ - public AbstractModelElement getModelElementByType(String type) { - AbstractModelElement modelElement = modelElements.get(type); - if (modelElement == null) { - throw new IllegalArgumentException("Invalid or not found ModelElement type: " + type); - } - return modelElement; - } - - /** * @return the modelName */ public String getModelName() { @@ -231,12 +214,11 @@ public class ModelProperties { } /** - * @return The policyName that wil be used in input parameters of DCAE - * deploy + * @return The policyName that wil be used in input parameters of DCAE deploy */ public String getPolicyNameForDcaeDeploy(ClampProperties refProp) { return normalizePolicyScopeName(modelName + createScopeSeparator(modelName) - + refProp.getStringValue(PolicyClient.POLICY_MS_NAME_PREFIX_PROPERTY_NAME) + getCurrentPolicyName()); + + refProp.getStringValue(PolicyClient.POLICY_MS_NAME_PREFIX_PROPERTY_NAME) + getCurrentPolicyName()); } /** @@ -251,8 +233,8 @@ public class ModelProperties { * @return the policyScopeAndNameWithUniqueId */ public String getPolicyScopeAndNameWithUniqueGuardId() { - return normalizePolicyScopeName( - modelName + createScopeSeparator(modelName) + getCurrentPolicyName() + "_" + policyUniqueId+POLICY_GUARD_SUFFIX+guardUniqueId); + return normalizePolicyScopeName(modelName + createScopeSeparator(modelName) + getCurrentPolicyName() + "_" + + policyUniqueId + POLICY_GUARD_SUFFIX + guardUniqueId); } /** @@ -264,6 +246,24 @@ public class ModelProperties { } /** + * @return the PolicyNameWithScopeContext + */ + public String getPolicyNameWithScopeContext(String policyScope, String policyType, String vnfScope, String context, + String userDefinedName) { + return normalizePolicyScopeName(policyScope + createScopeSeparator(policyScope) + policyType + "_" + vnfScope + + "_" + context + "_" + modelName + "_" + userDefinedName); + } + + /** + * @return the PolicyNameWithPrefixScopeContext + */ + public String getPolicyNameWithPrefixScopeContext(String policyScope, String policyType, String vnfScope, + String context, String userDefinedName, String policyPrefix) { + return normalizePolicyScopeName(policyScope + createScopeSeparator(policyScope) + policyPrefix + policyType + + "_" + vnfScope + "_" + context + "_" + modelName + "_" + userDefinedName); + } + + /** * Replace all '-' with '_' within policy scope and name. * * @param inName @@ -281,11 +281,11 @@ public class ModelProperties { } /** - * When generating a policy request for a model element, must set the id of - * that model element using this method. Used to generate the policy name. + * When generating a policy request for a model element, must set the id of that + * model element using this method. Used to generate the policy name. * * @param currentModelElementId - * the currentModelElementId to set + * the currentModelElementId to set */ public void setCurrentModelElementId(String currentModelElementId) { this.currentModelElementId = currentModelElementId; @@ -307,11 +307,11 @@ public class ModelProperties { } /** - * When generating a policy request for a model element, must set the unique - * id of that policy using this method. Used to generate the policy name. + * When generating a policy request for a model element, must set the unique id + * of that policy using this method. Used to generate the policy name. * * @param policyUniqueId - * the policyUniqueId to set + * the policyUniqueId to set */ public void setPolicyUniqueId(String policyUniqueId) { this.policyUniqueId = policyUniqueId; @@ -332,26 +332,6 @@ public class ModelProperties { } /** - * @return the isCreateRequest - */ - public boolean isCreateRequest() { - switch (actionCd) { - case CldsEvent.ACTION_SUBMIT: - case CldsEvent.ACTION_RESTART: - return true; - } - return false; - } - - public boolean isStopRequest() { - switch (actionCd) { - case CldsEvent.ACTION_STOP: - return true; - } - return false; - } - - /** * @return the global */ public Global getGlobal() { diff --git a/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java b/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java new file mode 100644 index 000000000..300c8b133 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/status/StatusHandler.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.model.status; + +import org.onap.clamp.clds.model.CldsEvent; +import org.onap.clamp.clds.model.CldsModel; + +/** + * This interface describe the handler of the status in CldsModel, it's normally + * based on the last event stored in db. + * + */ +public interface StatusHandler { + + /** + * This method determines the status of the closed loop based on the last event. + * + * @param event + * The last event + * @return The status + */ + default String determineStatusOnLastEvent(CldsEvent event) { + String status = CldsModel.STATUS_UNKNOWN; + if (event == null || event.getActionCd() == null) { + status = CldsModel.STATUS_DESIGN; + } else if (event.isActionStateCd(CldsEvent.ACTION_STATE_ERROR)) { + status = CldsModel.STATUS_ERROR; + } else if (event.isActionAndStateCd(CldsEvent.ACTION_CREATE, CldsEvent.ACTION_STATE_ANY)) { + status = CldsModel.STATUS_DESIGN; + } else if (event.isActionAndStateCd(CldsEvent.ACTION_DISTRIBUTE, CldsEvent.ACTION_STATE_RECEIVED) + || event.isActionAndStateCd(CldsEvent.ACTION_UNDEPLOY, CldsEvent.ACTION_STATE_COMPLETED) + || event.isActionAndStateCd(CldsEvent.ACTION_SUBMIT, CldsEvent.ACTION_STATE_COMPLETED) + || event.isActionAndStateCd(CldsEvent.ACTION_RESUBMIT, CldsEvent.ACTION_STATE_COMPLETED)) { + status = CldsModel.STATUS_DISTRIBUTED; + } else if (event.isActionAndStateCd(CldsEvent.ACTION_DELETE, CldsEvent.ACTION_STATE_SENT)) { + status = CldsModel.STATUS_DELETING; + } else if (event.isActionAndStateCd(CldsEvent.ACTION_DEPLOY, CldsEvent.ACTION_STATE_COMPLETED) + || event.isActionAndStateCd(CldsEvent.ACTION_RESTART, CldsEvent.ACTION_STATE_COMPLETED) + || event.isActionAndStateCd(CldsEvent.ACTION_UPDATE, CldsEvent.ACTION_STATE_COMPLETED) + || event.isActionAndStateCd(CldsEvent.ACTION_SUBMITPOLICY, CldsEvent.ACTION_STATE_ANY)) { + status = CldsModel.STATUS_ACTIVE; + } else if (event.isActionAndStateCd(CldsEvent.ACTION_STOP, CldsEvent.ACTION_STATE_COMPLETED)) { + status = CldsModel.STATUS_STOPPED; + } + return status; + } +} diff --git a/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java b/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java new file mode 100644 index 000000000..b539e9050 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/status/StatusHandlerImpl.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.model.status; + +public class StatusHandlerImpl implements StatusHandler { +} diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java index 8796bae1c..5959c0fb5 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java @@ -19,7 +19,7 @@ * ============LICENSE_END============================================
* Modifications copyright (c) 2018 Nokia
* ===================================================================
- *
+ *
*/
package org.onap.clamp.clds.sdc.controller;
@@ -81,8 +81,8 @@ public class SdcSingleController { }
/**
- * This method can be called multiple times at the same moment. The
- * controller must be thread safe !
+ * This method can be called multiple times at the same moment. The controller
+ * must be thread safe !
*/
@Override
public void activateCallback(INotificationData iNotif) {
@@ -91,7 +91,7 @@ public class SdcSingleController { sdcController.treatNotification(iNotif);
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "SDC Notification received and processed successfully",
- this.getClass().getName());
+ this.getClass().getName());
}
}
@@ -110,16 +110,16 @@ public class SdcSingleController { protected final synchronized void changeControllerStatus(SdcSingleControllerStatus newControllerStatus) {
switch (newControllerStatus) {
- case BUSY:
- ++this.nbOfNotificationsOngoing;
- this.controllerStatus = newControllerStatus;
- break;
- case IDLE:
- this.changeControllerStatusIdle();
- break;
- default:
- this.controllerStatus = newControllerStatus;
- break;
+ case BUSY:
+ ++this.nbOfNotificationsOngoing;
+ this.controllerStatus = newControllerStatus;
+ break;
+ case IDLE:
+ this.changeControllerStatusIdle();
+ break;
+ default:
+ this.controllerStatus = newControllerStatus;
+ break;
}
}
@@ -128,8 +128,9 @@ public class SdcSingleController { }
public SdcSingleController(ClampProperties clampProp, CsarInstaller csarInstaller,
- SdcSingleControllerConfiguration sdcSingleConfig, boolean isClientAutoManaged) {
- this.isSdcClientAutoManaged = isClientAutoManaged;
+ SdcSingleControllerConfiguration sdcSingleConfig, IDistributionClient distributionClient) {
+ this.distributionClient = distributionClient;
+ isSdcClientAutoManaged = (distributionClient == null);
this.sdcConfig = sdcSingleConfig;
this.refProp = clampProp;
this.csarInstaller = csarInstaller;
@@ -139,11 +140,10 @@ public class SdcSingleController { * This method initializes the SDC Controller and the SDC Client.
*
* @throws SdcControllerException
- * It throws an exception if the SDC Client cannot be
- * instantiated or if an init attempt is done when already
- * initialized
+ * It throws an exception if the SDC Client cannot be instantiated or if
+ * an init attempt is done when already initialized
* @throws SdcParametersException
- * If there is an issue with the parameters provided
+ * If there is an issue with the parameters provided
*/
public void initSdc() throws SdcControllerException {
logger.info("Attempt to initialize the SDC Controller: " + sdcConfig.getSdcControllerName());
@@ -157,8 +157,8 @@ public class SdcSingleController { if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
logger.error("SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);
- throw new SdcControllerException("Initialization of the SDC Controller failed with reason: "
- + result.getDistributionMessageResult());
+ throw new SdcControllerException(
+ "Initialization of the SDC Controller failed with reason: " + result.getDistributionMessageResult());
}
logger.info("SDC Controller successfully initialized: " + sdcConfig.getSdcControllerName());
logger.info("Attempt to start the SDC Controller: " + sdcConfig.getSdcControllerName());
@@ -167,7 +167,7 @@ public class SdcSingleController { logger.error("SDC distribution client start failed with reason:" + result.getDistributionMessageResult());
this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);
throw new SdcControllerException(
- "Startup of the SDC Controller failed with reason: " + result.getDistributionMessageResult());
+ "Startup of the SDC Controller failed with reason: " + result.getDistributionMessageResult());
}
logger.info("SDC Controller successfully started: " + sdcConfig.getSdcControllerName());
this.changeControllerStatus(SdcSingleControllerStatus.IDLE);
@@ -177,8 +177,8 @@ public class SdcSingleController { * This method closes the SDC Controller and the SDC Client.
*
* @throws SdcControllerException
- * It throws an exception if the SDC Client cannot be closed
- * because it's currently BUSY in processing notifications.
+ * It throws an exception if the SDC Client cannot be closed because
+ * it's currently BUSY in processing notifications.
*/
public void closeSdc() throws SdcControllerException {
if (this.getControllerStatus() == SdcSingleControllerStatus.BUSY) {
@@ -198,33 +198,33 @@ public class SdcSingleController { }
private void sendAllNotificationForCsarHandler(INotificationData iNotif, CsarHandler csar,
- NotificationType notificationType, DistributionStatusEnum distributionStatus, String errorMessage) {
+ NotificationType notificationType, DistributionStatusEnum distributionStatus, String errorMessage) {
if (csar != null) {
// Notify for the CSAR
this.sendSdcNotification(notificationType, csar.getArtifactElement().getArtifactURL(),
- sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
- System.currentTimeMillis());
+ sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
+ System.currentTimeMillis());
// Notify for all VF resources found
for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) {
// Normally always 1 artifact in resource for Clamp as we
// specified
// only VF_METADATA type
this.sendSdcNotification(notificationType,
- blueprint.getValue().getResourceAttached().getArtifacts().get(0).getArtifactURL(),
- sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
- System.currentTimeMillis());
+ blueprint.getValue().getResourceAttached().getArtifacts().get(0).getArtifactURL(),
+ sdcConfig.getConsumerID(), iNotif.getDistributionID(), distributionStatus, errorMessage,
+ System.currentTimeMillis());
}
} else {
this.sendSdcNotification(notificationType, null, sdcConfig.getConsumerID(), iNotif.getDistributionID(),
- distributionStatus, errorMessage, System.currentTimeMillis());
+ distributionStatus, errorMessage, System.currentTimeMillis());
}
}
/**
* This method processes the notification received from Sdc.
- *
+ *
* @param iNotif
- * The INotificationData
+ * The INotificationData
*/
public void treatNotification(INotificationData iNotif) {
CsarHandler csar = null;
@@ -235,37 +235,37 @@ public class SdcSingleController { logger.info("Notification received for service UUID:" + iNotif.getServiceUUID());
this.changeControllerStatus(SdcSingleControllerStatus.BUSY);
csar = new CsarHandler(iNotif, this.sdcConfig.getSdcControllerName(),
- refProp.getStringValue(CONFIG_SDC_FOLDER));
+ refProp.getStringValue(CONFIG_SDC_FOLDER));
csar.save(downloadTheArtifact(csar.getArtifactElement()));
if (csarInstaller.isCsarAlreadyDeployed(csar)) {
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DOWNLOAD,
- DistributionStatusEnum.ALREADY_DOWNLOADED, null);
+ DistributionStatusEnum.ALREADY_DOWNLOADED, null);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.ALREADY_DEPLOYED, null);
+ DistributionStatusEnum.ALREADY_DEPLOYED, null);
} else {
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DOWNLOAD,
- DistributionStatusEnum.DOWNLOAD_OK, null);
+ DistributionStatusEnum.DOWNLOAD_OK, null);
csarInstaller.installTheCsar(csar);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_OK, null);
+ DistributionStatusEnum.DEPLOY_OK, null);
}
} catch (SdcArtifactInstallerException | SdcToscaParserException e) {
logger.error("SdcArtifactInstallerException exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
} catch (SdcDownloadException | CsarHandlerException e) {
logger.error("SdcDownloadException exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DOWNLOAD,
- DistributionStatusEnum.DOWNLOAD_ERROR, e.getMessage());
+ DistributionStatusEnum.DOWNLOAD_ERROR, e.getMessage());
} catch (InterruptedException e) {
logger.error("Interrupt exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
Thread.currentThread().interrupt();
} catch (RuntimeException e) {
logger.error("Unexpected exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(iNotif, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
} finally {
this.changeControllerStatus(SdcSingleControllerStatus.IDLE);
}
@@ -276,8 +276,8 @@ public class SdcSingleController { }
private IDistributionClientDownloadResult downloadTheArtifact(IArtifactInfo artifact) throws SdcDownloadException {
- logger.info("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "
- + artifact.getArtifactUUID());
+ logger.info(
+ "Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: " + artifact.getArtifactUUID());
IDistributionClientDownloadResult downloadResult;
try {
downloadResult = distributionClient.download(artifact);
@@ -290,20 +290,20 @@ public class SdcSingleController { }
if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult())) {
logger.info("Successfully downloaded the artifact " + artifact.getArtifactURL() + " UUID "
- + artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length);
+ + artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length);
} else {
- throw new SdcDownloadException("Artifact " + artifact.getArtifactName()
- + " could not be downloaded from SDC URL " + artifact.getArtifactURL() + " UUID "
- + artifact.getArtifactUUID() + ")" + System.lineSeparator() + "Error message is "
- + downloadResult.getDistributionMessageResult() + System.lineSeparator());
+ throw new SdcDownloadException(
+ "Artifact " + artifact.getArtifactName() + " could not be downloaded from SDC URL "
+ + artifact.getArtifactURL() + " UUID " + artifact.getArtifactUUID() + ")" + System.lineSeparator()
+ + "Error message is " + downloadResult.getDistributionMessageResult() + System.lineSeparator());
}
return downloadResult;
}
private void sendSdcNotification(NotificationType notificationType, String artifactURL, String consumerID,
- String distributionID, DistributionStatusEnum status, String errorReason, long timestamp) {
+ String distributionID, DistributionStatusEnum status, String errorReason, long timestamp) {
String event = "Sending " + notificationType.name() + "(" + status.name() + ")"
- + " notification to SDC for artifact:" + artifactURL;
+ + " notification to SDC for artifact:" + artifactURL;
if (errorReason != null) {
event = event + "(" + errorReason + ")";
}
@@ -311,18 +311,18 @@ public class SdcSingleController { String action = "";
try {
IDistributionStatusMessage message = new DistributionStatusMessage(artifactURL, consumerID, distributionID,
- status, timestamp);
+ status, timestamp);
switch (notificationType) {
- case DOWNLOAD:
- this.sendDownloadStatus(message, errorReason);
- action = "sendDownloadStatus";
- break;
- case DEPLOY:
- this.sendDeploymentStatus(message, errorReason);
- action = "sendDeploymentdStatus";
- break;
- default:
- break;
+ case DOWNLOAD:
+ this.sendDownloadStatus(message, errorReason);
+ action = "sendDownloadStatus";
+ break;
+ case DEPLOY:
+ this.sendDeploymentStatus(message, errorReason);
+ action = "sendDeploymentdStatus";
+ break;
+ default:
+ break;
}
} catch (RuntimeException e) {
logger.warn("Unable to send the SDC Notification (" + action + ") due to an exception", e);
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java index 5d5e218a2..0fb1e0f3a 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java @@ -44,106 +44,116 @@ import org.springframework.stereotype.Component; @Component public class CldsDictionaryService extends SecureServiceBase { - @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}") - private String cldsPermissionTypeTosca; - @Value("${clamp.config.security.permission.instance:dev}") - private String cldsPermissionInstance; - private SecureServicePermission permissionReadTosca; - private SecureServicePermission permissionUpdateTosca; + @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}") + private String cldsPermissionTypeTosca; + @Value("${clamp.config.security.permission.instance:dev}") + private String cldsPermissionInstance; + private SecureServicePermission permissionReadTosca; + private SecureServicePermission permissionUpdateTosca; - @Autowired - private CldsDao cldsDao; + @Autowired + private CldsDao cldsDao; + + private LoggingUtils util = new LoggingUtils(logger); + - @PostConstruct - private final void initConstruct() { - permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read"); - permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "update"); - } + @PostConstruct + private final void initConstruct() { + permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read"); + permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, + "update"); + } - /** - * REST Service that creates or Updates a Dictionary - * - * @param dictionaryName - * @param cldsDictionary - * @return CldsDictionary that was created in DB. - */ - public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName, - CldsDictionary cldsDictionary) { - Date startTime = new Date(); - LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionary", getPrincipalName()); - // TODO revisit based on new permissions - isAuthorized(permissionUpdateTosca); - if (cldsDictionary == null) { - cldsDictionary = new CldsDictionary(); - cldsDictionary.setDictionaryName(dictionaryName); - } - cldsDictionary.save(dictionaryName, cldsDao, getUserId()); - LoggingUtils.setTimeContext(startTime, new Date()); - LoggingUtils.setResponseContext("0", "createOrUpdateDictionary success", this.getClass().getName()); - auditLogger.info("createOrUpdateDictionary completed"); - return new ResponseEntity<>(cldsDictionary, HttpStatus.OK); - } + /** + * REST Service that creates or Updates a Dictionary + * + * @param dictionaryName + * @param cldsDictionary + * @return CldsDictionary that was created in DB. + */ + public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName, + CldsDictionary cldsDictionary) { + Date startTime = new Date(); + LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionary", getPrincipalName()); + // TODO revisit based on new permissions + isAuthorized(permissionUpdateTosca); + if (cldsDictionary == null) { + cldsDictionary = new CldsDictionary(); + cldsDictionary.setDictionaryName(dictionaryName); + } + cldsDictionary.save(dictionaryName, cldsDao, getUserId()); + LoggingUtils.setTimeContext(startTime, new Date()); + LoggingUtils.setResponseContext("0", "createOrUpdateDictionary success", this.getClass().getName()); + auditLogger.info("createOrUpdateDictionary completed"); + return new ResponseEntity<>(cldsDictionary, HttpStatus.OK); + } - /** - * REST Service that creates or Updates a Dictionary Elements for dictionary in DB - * - * @param dictionaryName - * @param dictionaryItem - * @return CldsDictionaryItem - * A dictionary items that was created or updated in DB - */ - public ResponseEntity<CldsDictionaryItem> createOrUpdateDictionaryElements(String dictionaryName, - CldsDictionaryItem dictionaryItem) { - Date startTime = new Date(); - LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionaryElements", getPrincipalName()); - // TODO revisit based on new permissions - isAuthorized(permissionUpdateTosca); - dictionaryItem.save(dictionaryName, cldsDao, getUserId()); - LoggingUtils.setTimeContext(startTime, new Date()); - LoggingUtils.setResponseContext("0", "createOrUpdateDictionaryElements success", this.getClass().getName()); - auditLogger.info("createOrUpdateDictionaryElements completed"); - return new ResponseEntity<>(dictionaryItem, HttpStatus.OK); - } + /** + * REST Service that creates or Updates a Dictionary Elements for dictionary + * in DB + * + * @param dictionaryName + * @param dictionaryItem + * @return CldsDictionaryItem A dictionary items that was created or updated + * in DB + */ + public ResponseEntity<CldsDictionaryItem> createOrUpdateDictionaryElements(String dictionaryName, + CldsDictionaryItem dictionaryItem) { + Date startTime = new Date(); + LoggingUtils.setRequestContext("CldsDictionaryService: createOrUpdateDictionaryElements", getPrincipalName()); + // TODO revisit based on new permissions + isAuthorized(permissionUpdateTosca); + dictionaryItem.save(dictionaryName, cldsDao, getUserId()); + LoggingUtils.setTimeContext(startTime, new Date()); + LoggingUtils.setResponseContext("0", "createOrUpdateDictionaryElements success", this.getClass().getName()); + auditLogger.info("createOrUpdateDictionaryElements completed"); + return new ResponseEntity<>(dictionaryItem, HttpStatus.OK); + } - /** - * Rest Service that retrieves all CLDS dictionary in DB - * - * @return CldsDictionary List - * List of CldsDictionary available in DB - */ - public ResponseEntity<List<CldsDictionary>> getAllDictionaryNames() { - Date startTime = new Date(); - LoggingUtils.setRequestContext("CldsDictionaryService: getAllDictionaryNames", getPrincipalName()); - // TODO revisit based on new permissions - isAuthorized(permissionReadTosca); - List<CldsDictionary> dictionaries = cldsDao.getDictionary(null, null); - LoggingUtils.setTimeContext(startTime, new Date()); - LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName()); - auditLogger.info("getAllDictionaryNames completed"); - return new ResponseEntity<>(dictionaries, HttpStatus.OK); - } + /** + * Rest Service that retrieves all CLDS dictionary in DB + * + * @return CldsDictionary List List of CldsDictionary available in DB + */ + public ResponseEntity<List<CldsDictionary>> getAllDictionaryNames() { + Date startTime = new Date(); + LoggingUtils.setRequestContext("CldsDictionaryService: getAllDictionaryNames", getPrincipalName()); + // TODO revisit based on new permissions + isAuthorized(permissionReadTosca); + List<CldsDictionary> dictionaries = cldsDao.getDictionary(null, null); + LoggingUtils.setTimeContext(startTime, new Date()); + LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName()); + auditLogger.info("getAllDictionaryNames completed"); + return new ResponseEntity<>(dictionaries, HttpStatus.OK); + } - /** - * Rest Service that retrieves all CLDS dictionary items in DB for a give dictionary name - * - * @param dictionaryName - * @return CldsDictionaryItem list - * List of CLDS Dictionary items for a given dictionary name - */ - public ResponseEntity<List<CldsDictionaryItem>> getDictionaryElementsByName(String dictionaryName) { - Date startTime = new Date(); - LoggingUtils.setRequestContext("CldsDictionaryService: getDictionaryElementsByName", getPrincipalName()); - // TODO revisit based on new permissions - isAuthorized(permissionReadTosca); - List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName, null, null); - LoggingUtils.setTimeContext(startTime, new Date()); - LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName()); - auditLogger.info("getAllDictionaryNames completed"); - return new ResponseEntity<>(dictionaryItems, HttpStatus.OK); - } + /** + * Rest Service that retrieves all CLDS dictionary items in DB for a give + * dictionary name + * + * @param dictionaryName + * @return CldsDictionaryItem list List of CLDS Dictionary items for a given + * dictionary name + */ + public ResponseEntity<List<CldsDictionaryItem>> getDictionaryElementsByName(String dictionaryName) { + Date startTime = new Date(); + LoggingUtils.setRequestContext("CldsDictionaryService: getDictionaryElementsByName", getPrincipalName()); + // TODO revisit based on new permissions + isAuthorized(permissionReadTosca); + List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName, null, null); + LoggingUtils.setTimeContext(startTime, new Date()); + LoggingUtils.setResponseContext("0", "getAllDictionaryNames success", this.getClass().getName()); + auditLogger.info("getAllDictionaryNames completed"); + return new ResponseEntity<>(dictionaryItems, HttpStatus.OK); + } - public ResponseEntity<?> deleteDictionary() { - return null; - } + public ResponseEntity<?> deleteDictionary() { + return null; + } + + // Created for the integration test + public void setLoggingUtil(LoggingUtils utilP) { + util = utilP; + } } diff --git a/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java b/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java index a017d54b0..c25e6e7ac 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java @@ -29,6 +29,8 @@ import java.util.Date; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsHealthCheck; import org.onap.clamp.clds.util.LoggingUtils; +import org.onap.clamp.clds.util.ONAPLogConstants; +import org.slf4j.event.Level; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -54,6 +56,7 @@ public class CldsHealthcheckService { public ResponseEntity<CldsHealthCheck> gethealthcheck() { CldsHealthCheck cldsHealthCheck = new CldsHealthCheck(); Date startTime = new Date(); + LoggingUtils util = new LoggingUtils(logger); LoggingUtils.setRequestContext("CldsService: GET healthcheck", "Clamp-Health-Check"); LoggingUtils.setTimeContext(startTime, new Date()); boolean healthcheckFailed = false; @@ -74,8 +77,10 @@ public class CldsHealthcheckService { // audit log LoggingUtils.setTimeContext(startTime, new Date()); if(healthcheckFailed) { + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); return new ResponseEntity<>(cldsHealthCheck, HttpStatus.INTERNAL_SERVER_ERROR); } else { + util.exiting("200", "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED); return new ResponseEntity<>(cldsHealthCheck, HttpStatus.OK); } } diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index be19e31c0..206a4246b 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -52,7 +52,6 @@ import org.onap.clamp.clds.client.DcaeInventoryServices; import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices; import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.dao.CldsDao; -import org.onap.clamp.clds.exception.CldsConfigException; import org.onap.clamp.clds.exception.policy.PolicyClientException; import org.onap.clamp.clds.exception.sdc.SdcCommunicationException; import org.onap.clamp.clds.model.CldsDbServiceCache; @@ -67,8 +66,6 @@ import org.onap.clamp.clds.model.DcaeEvent; import org.onap.clamp.clds.model.ValueItem; import org.onap.clamp.clds.model.properties.AbstractModelElement; import org.onap.clamp.clds.model.properties.ModelProperties; -import org.onap.clamp.clds.model.sdc.SdcResource; -import org.onap.clamp.clds.model.sdc.SdcServiceDetail; import org.onap.clamp.clds.model.sdc.SdcServiceInfo; import org.onap.clamp.clds.sdc.controller.installer.CsarInstallerImpl; import org.onap.clamp.clds.transform.XslTransformer; @@ -163,7 +160,7 @@ public class CldsService extends SecureServiceBase { * used to generate the ClosedLoop model. ACTION_CD | Current state of the * ClosedLoop in CLDS application. */ - public List<CldsMonitoringDetails> getCLDSDetails() { + public List<CldsMonitoringDetails> getCldsDetails() { util.entering(request, "CldsService: GET model details"); Date startTime = new Date(); List<CldsMonitoringDetails> cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails(); @@ -503,7 +500,7 @@ public class CldsService extends SecureServiceBase { * In case of issues */ public String getSdcProperties() throws IOException { - return createPropertiesObjectByUUID("{}"); + return ((ObjectNode) refProp.getJsonTemplate(GLOBAL_PROPERTIES_KEY)).toString(); } /** @@ -603,114 +600,6 @@ public class CldsService extends SecureServiceBase { return serviceNode.toString(); } - private String createPropertiesObjectByUUID(String cldsResponseStr) throws IOException { - ObjectMapper mapper = JacksonUtils.getObjectMapperInstance(); - SdcServiceDetail cldsSdcServiceDetail = mapper.readValue(cldsResponseStr, SdcServiceDetail.class); - ObjectNode globalPropsJson = (ObjectNode) refProp.getJsonTemplate(GLOBAL_PROPERTIES_KEY); - if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getUuid() != null) { - /** - * to create json with vf, alarm and locations - */ - ObjectNode serviceObjectNode = createEmptyVfAlarmObject(); - ObjectNode vfObjectNode = mapper.createObjectNode(); - /** - * to create json with vf and vfresourceId - */ - createVfObjectNode(vfObjectNode, cldsSdcServiceDetail.getResources()); - serviceObjectNode.putPOJO(cldsSdcServiceDetail.getInvariantUUID(), vfObjectNode); - ObjectNode byServiceBasicObjetNode = mapper.createObjectNode(); - byServiceBasicObjetNode.putPOJO("byService", serviceObjectNode); - /** - * to create json with VFC Node - */ - ObjectNode emptyvfcobjectNode = createByVFCObjectNode(cldsSdcServiceDetail.getResources()); - byServiceBasicObjetNode.putPOJO("byVf", emptyvfcobjectNode); - globalPropsJson.putPOJO("shared", byServiceBasicObjetNode); - logger.info("valuie of objNode: {}", globalPropsJson); - } - return globalPropsJson.toString(); - } - - private ObjectNode createEmptyVfAlarmObject() { - ObjectMapper mapper = JacksonUtils.getObjectMapperInstance(); - ObjectNode emptyObjectNode = mapper.createObjectNode(); - emptyObjectNode.put("", ""); - ObjectNode vfObjectNode = mapper.createObjectNode(); - vfObjectNode.putPOJO("vf", emptyObjectNode); - vfObjectNode.putPOJO("location", emptyObjectNode); - vfObjectNode.putPOJO("alarmCondition", emptyObjectNode); - ObjectNode emptyServiceObjectNode = mapper.createObjectNode(); - emptyServiceObjectNode.putPOJO("", vfObjectNode); - return emptyServiceObjectNode; - } - - private void createVfObjectNode(ObjectNode vfObjectNode2, List<SdcResource> rawCldsSdcResourceList) { - ObjectMapper mapper = JacksonUtils.getObjectMapperInstance(); - ObjectNode vfNode = mapper.createObjectNode(); - vfNode.put("", ""); - // To remove repeated resource instance name from - // resourceInstanceList - List<SdcResource> cldsSdcResourceList = sdcCatalogServices - .removeDuplicateSdcResourceInstances(rawCldsSdcResourceList); - /** - * Creating vf resource node using cldsSdcResource Object - */ - if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) { - for (SdcResource cldsSdcResource : cldsSdcResourceList) { - if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) { - vfNode.put(cldsSdcResource.getResourceUUID(), cldsSdcResource.getResourceName()); - } - } - } - vfObjectNode2.putPOJO("vf", vfNode); - /** - * creating location json object using properties file value - */ - ObjectNode locationJsonNode; - try { - locationJsonNode = (ObjectNode) mapper.readValue(refProp.getStringValue("ui.location.default"), - JsonNode.class); - } catch (IOException e) { - logger.error("Unable to load ui.location.default JSON in clds-references.properties properly", e); - throw new CldsConfigException( - "Unable to load ui.location.default JSON in clds-references.properties properly", e); - } - vfObjectNode2.putPOJO("location", locationJsonNode); - /** - * creating alarm json object using properties file value - */ - String alarmStringValue = refProp.getStringValue("ui.alarm.default"); - logger.info("value of alarm: {}", alarmStringValue); - ObjectNode alarmStringJsonNode; - try { - alarmStringJsonNode = (ObjectNode) mapper.readValue(alarmStringValue, JsonNode.class); - } catch (IOException e) { - logger.error("Unable to ui.alarm.default JSON in clds-references.properties properly", e); - throw new CldsConfigException("Unable to load ui.alarm.default JSON in clds-references.properties properly", - e); - } - vfObjectNode2.putPOJO("alarmCondition", alarmStringJsonNode); - } - - private ObjectNode createByVFCObjectNode(List<SdcResource> cldsSdcResourceList) { - ObjectMapper mapper = JacksonUtils.getObjectMapperInstance(); - ObjectNode emptyObjectNode = mapper.createObjectNode(); - ObjectNode emptyvfcobjectNode = mapper.createObjectNode(); - ObjectNode vfCObjectNode = mapper.createObjectNode(); - vfCObjectNode.putPOJO("vfC", emptyObjectNode); - ObjectNode subVfCObjectNode = mapper.createObjectNode(); - subVfCObjectNode.putPOJO("vfc", emptyObjectNode); - if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) { - for (SdcResource cldsSdcResource : cldsSdcResourceList) { - if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) { - vfCObjectNode.putPOJO(cldsSdcResource.getResourceUUID(), subVfCObjectNode); - } - } - } - emptyvfcobjectNode.putPOJO("", vfCObjectNode); - return emptyvfcobjectNode; - } - public ResponseEntity<CldsModel> deployModel(String modelName, CldsModel model) { util.entering(request, "CldsService: Deploy model"); Date startTime = new Date(); diff --git a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java index f33039f01..04205b704 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java @@ -29,6 +29,8 @@ import java.util.Optional; import javax.annotation.PostConstruct; +import org.onap.clamp.clds.client.req.policy.PolicyClient; +import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsToscaModel; import org.onap.clamp.clds.util.LoggingUtils; @@ -44,106 +46,124 @@ import org.springframework.stereotype.Component; @Component public class CldsToscaService extends SecureServiceBase { - @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}") - private String cldsPermissionTypeTosca; - @Value("${clamp.config.security.permission.instance:dev}") - private String cldsPermissionInstance; - private SecureServicePermission permissionReadTosca; - private SecureServicePermission permissionUpdateTosca; - - @Autowired - private CldsDao cldsDao; - - @PostConstruct - private final void initConstruct() { - permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read"); - permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "update"); - } - - /** - * REST service to upload a new Tosca Model or update an existing Tosca model with new version. - * This API will parse the Tosca model yaml and generates a JSON schema out of it. - * - * @param toscaModelName - * Tosca model name to be used as a key - * @param cldsToscaModel - * Object containing the tosca model yaml - * - * @return clds tosca models - list of CLDS tosca models for a given policy type - */ - public ResponseEntity<?> parseToscaModelAndSave(String toscaModelName, CldsToscaModel cldsToscaModel ) { + @Value("${clamp.config.security.permission.type.tosca:permission-type-tosca}") + private String cldsPermissionTypeTosca; + @Value("${clamp.config.security.permission.instance:dev}") + private String cldsPermissionInstance; + private SecureServicePermission permissionReadTosca; + private SecureServicePermission permissionUpdateTosca; + + @Autowired + private CldsDao cldsDao; + + @Autowired + private ClampProperties refProp; + + @Autowired + private PolicyClient policyClient; + private LoggingUtils util = new LoggingUtils(logger); + + @PostConstruct + private final void initConstruct() { + permissionReadTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, "read"); + permissionUpdateTosca = SecureServicePermission.create(cldsPermissionTypeTosca, cldsPermissionInstance, + "update"); + } + + /** + * REST service to upload a new Tosca Model or update an existing Tosca + * model with new version. This API will parse the Tosca model yaml and + * generates a JSON schema out of it. + * + * @param toscaModelName + * Tosca model name to be used as a key + * @param cldsToscaModel + * Object containing the tosca model yaml + * + * @return clds tosca models - list of CLDS tosca models for a given policy + * type + */ + public ResponseEntity<?> parseToscaModelAndSave(String toscaModelName, CldsToscaModel cldsToscaModel) { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsToscaService: Parse Tosca model and save", getPrincipalName()); - //TODO revisit based on new permissions + // TODO revisit based on new permissions isAuthorized(permissionUpdateTosca); cldsToscaModel.setToscaModelName(toscaModelName); - cldsToscaModel = cldsToscaModel.save(cldsDao, getUserId()); + cldsToscaModel = cldsToscaModel.save(cldsDao, refProp, policyClient, getUserId()); LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Parse Tosca model and save success", this.getClass().getName()); auditLogger.info("Parse Tosca model and save completed"); return new ResponseEntity<>(cldsToscaModel, HttpStatus.CREATED); - } - - /** - * REST service to retrieve all Tosca models from the CLDS database. - * - * @return clds tosca models - list of CLDS tosca models - */ - public ResponseEntity<List<CldsToscaModel>> getAllToscaModels() { - - Date startTime = new Date(); + } + + /** + * REST service to retrieve all Tosca models from the CLDS database. + * + * @return clds tosca models - list of CLDS tosca models + */ + public ResponseEntity<List<CldsToscaModel>> getAllToscaModels() { + + Date startTime = new Date(); LoggingUtils.setRequestContext("CldsToscaService: Get All tosca models", getPrincipalName()); - //TODO revisit based on new permissions + // TODO revisit based on new permissions isAuthorized(permissionReadTosca); List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getAllToscaModels()).get(); LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get All tosca models success", this.getClass().getName()); auditLogger.info("Get All tosca models"); return new ResponseEntity<>(cldsToscaModels, HttpStatus.OK); - } - - /** - * REST service that retrieves a CLDS Tosca model by model name from the database. - * - * @param toscaModelName - * Path param with tosca model name - * - * @return clds tosca model - CLDS tosca model for a given tosca model name - */ - public ResponseEntity<CldsToscaModel> getToscaModel(String toscaModelName) { - Date startTime = new Date(); + } + + /** + * REST service that retrieves a CLDS Tosca model by model name from the + * database. + * + * @param toscaModelName + * Path param with tosca model name + * + * @return clds tosca model - CLDS tosca model for a given tosca model name + */ + public ResponseEntity<CldsToscaModel> getToscaModel(String toscaModelName) { + Date startTime = new Date(); LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by model name", getPrincipalName()); - //TODO revisit based on new permissions + // TODO revisit based on new permissions isAuthorized(permissionReadTosca); List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getToscaModelByName(toscaModelName)).get(); LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get tosca models by model name success", this.getClass().getName()); auditLogger.info("GET tosca models by model name completed"); - return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), HttpStatus.OK); - } - - - /** - * REST service that retrieves a CLDS Tosca model lists for a policy type from the database. - * - * @param policyType - * @return clds tosca model - CLDS tosca model for a given policy type - */ - public ResponseEntity<CldsToscaModel> getToscaModelsByPolicyType(String policyType) { - Date startTime = new Date(); + return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), + HttpStatus.OK); + } + + /** + * REST service that retrieves a CLDS Tosca model lists for a policy type + * from the database. + * + * @param policyType + * @return clds tosca model - CLDS tosca model for a given policy type + */ + public ResponseEntity<CldsToscaModel> getToscaModelsByPolicyType(String policyType) { + Date startTime = new Date(); LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by policyType", getPrincipalName()); - //TODO revisit based on new permissions + // TODO revisit based on new permissions isAuthorized(permissionReadTosca); List<CldsToscaModel> cldsToscaModels = Optional.ofNullable(cldsDao.getToscaModelByPolicyType(policyType)).get(); LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "Get tosca models by policyType success", this.getClass().getName()); auditLogger.info("GET tosca models by policyType completed"); - return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), HttpStatus.OK); - } - - public ResponseEntity<?> deleteToscaModelById(String toscaModeId) { - //TODO - return null; - } - + return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(), + HttpStatus.OK); + } + + public ResponseEntity<?> deleteToscaModelById(String toscaModeId) { + // TODO + return null; + } + + // Created for the integration test + public void setLoggingUtil(LoggingUtils utilP) { + util = utilP; + } + } diff --git a/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java b/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java new file mode 100644 index 000000000..58a2f6f05 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/tosca/JsonEditorSchemaConstants.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.tosca; + +public class JsonEditorSchemaConstants { + + //Data types in JSON Schema + public static final String TYPE_OBJECT = "object"; + public static final String TYPE_ARRAY = "array"; + public static final String TYPE_STRING = "string"; + public static final String TYPE_INTEGER = "integer"; + + //Key elements in JSON Schema + public static final String TYPE = "type"; + public static final String TITLE = "title"; + public static final String REQUIRED = "required"; + public static final String DEFAULT = "default"; + public static final String ENUM = "enum"; + public static final String ENUM_TITLES = "enum_titles"; + public static final String OPTIONS = "options"; + public static final String FORMAT = "format"; + public static final String ITEMS = "items"; + public static final String PROPERTIES = "properties"; + public static final String PROPERTY_ORDER = "propertyOrder"; + + public static final String MINIMUM = "minimum"; + public static final String MAXIMUM = "maximum"; + public static final String MIN_LENGTH = "minLength"; + public static final String MAX_LENGTH = "maxLength"; + public static final String EXCLUSIVE_MINIMUM = "exclusiveMinimum"; + public static final String EXCLUSIVE_MAXIMUM = "exclusiveMaximum"; + + public static final String CUSTOM_KEY_FORMAT = "format"; + public static final String CUSTOM_KEY_FORMAT_TABS_TOP = "tabs-top"; + public static final String FORMAT_SELECT = "select"; + public static final String UNIQUE_ITEMS = "uniqueItems"; + public static final String TRUE = "true"; + public static final String QSSCHEMA = "qschema"; + public static final String TYPE_QBLDR = "qbldr"; + + public static final String ID = "id"; + public static final String LABEL = "label"; + public static final String OPERATORS = "operators"; + public static final String FILTERS = "filters"; + + public static final String SCHEMA = "schema"; + public static final String CURRENT_VALUES = "currentValues"; + + + + + + + + + +} diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java new file mode 100644 index 000000000..f5b5a8d2b --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaSchemaConstants.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.tosca; + +public class ToscaSchemaConstants { + + //Data types in TOSCA Schema + public static final String TYPE_LIST = "list"; + public static final String TYPE_MAP = "map"; + public static final String TYPE_STRING = "string"; + public static final String TYPE_INTEGER = "integer"; + public static final String TYPE_FLOAT = "float"; + public static final String TYPE_BOOLEAN = "boolean"; + + //Key elements in Tosca + public static final String NODE_TYPES = "node_types"; + public static final String DATA_TYPES = "data_types"; + public static final String TYPE = "type"; + public static final String DESCRIPTION = "description"; + public static final String DEFAULT = "default"; + public static final String PROPERTIES = "properties"; + public static final String REQUIRED = "required"; + public static final String ENTRY_SCHEMA = "entry_schema"; + + //Constraints + public static final String CONSTRAINTS = "constraints"; + public static final String VALID_VALUES = "valid_values"; + public static final String EQUAL = "equal"; + public static final String GREATER_THAN = "greater_than"; + public static final String GREATER_OR_EQUAL = "greater_or_equal"; + public static final String LESS_THAN = "less_than"; + public static final String LESS_OR_EQUAL = "less_or_equal"; + public static final String IN_RANGE = "in_range"; + public static final String LENGTH = "length"; + public static final String MIN_LENGTH = "min_length"; + public static final String MAX_LENGTH = "max_length"; + public static final String PATTERN = "pattern"; + + //Prefix for policy nodes + public static final String POLICY_NODE = "policy.nodes."; + + //Prefix for data nodes + public static final String POLICY_DATA = "policy.data."; + + //Prefix for dictionary elements + public static final String DICTIONARY = "Dictionary:"; + + //Custom Elements that must exist in the Tosca models + public static final String NAME = "name"; + public static final String CONTEXT = "context"; + + + + +} diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java new file mode 100644 index 000000000..784d95e94 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java @@ -0,0 +1,589 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.tosca; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.onap.clamp.clds.dao.CldsDao; +import org.onap.clamp.clds.model.CldsDictionaryItem; +import org.yaml.snakeyaml.Yaml; + +/** + * Tosca Model Yaml parser and convertor to JSON Schema consumable for JSON + * Editor + * + */ +public class ToscaYamlToJsonConvertor { + + private CldsDao cldsDao; + private int simpleTypeOrder = 1000; + private int complexTypeOrder = 10000; + private int complexSimpleTypeOrder = 1; + + public ToscaYamlToJsonConvertor(CldsDao cldsDao) { + this.cldsDao = cldsDao; + } + + private int incrementSimpleTypeOrder() { + return simpleTypeOrder++; + } + + private int incrementComplexTypeOrder() { + return complexTypeOrder = complexTypeOrder + 10000; + } + + private int incrementComplexSimpleTypeOrder() { + complexSimpleTypeOrder++; + return complexTypeOrder + complexSimpleTypeOrder; + } + + /** + * @return the cldsDao + */ + public CldsDao getCldsDao() { + return cldsDao; + } + + /** + * @param cldsDao + * the cldsDao to set + */ + public void setCldsDao(CldsDao cldsDao) { + this.cldsDao = cldsDao; + } + + @SuppressWarnings("unchecked") + public String parseToscaYaml(String yamlString) { + + Yaml yaml = new Yaml(); + LinkedHashMap<String, Object> loadedYaml = (LinkedHashMap<String, Object>) yaml.load(yamlString); + LinkedHashMap<String, Object> nodeTypes = new LinkedHashMap<String, Object>(); + LinkedHashMap<String, Object> dataNodes = new LinkedHashMap<String, Object>(); + JSONObject jsonEditorObject = new JSONObject(); + JSONObject jsonParentObject = new JSONObject(); + JSONObject jsonTempObject = new JSONObject(); + parseNodeAndDataType(loadedYaml, nodeTypes, dataNodes); + populateJsonEditorObject(loadedYaml, nodeTypes, dataNodes, jsonParentObject, jsonTempObject); + if (jsonTempObject.length() > 0) { + jsonParentObject = jsonTempObject; + } + jsonEditorObject.put(JsonEditorSchemaConstants.SCHEMA, jsonParentObject); + return jsonEditorObject.toString(); + } + + // Parse node_type and data_type + @SuppressWarnings("unchecked") + private void parseNodeAndDataType(LinkedHashMap<String, Object> map, LinkedHashMap<String, Object> nodeTypes, + LinkedHashMap<String, Object> dataNodes) { + map.entrySet().stream().forEach(n -> { + if (n.getKey().contains(ToscaSchemaConstants.NODE_TYPES) && n.getValue() instanceof Map) { + + parseNodeAndDataType((LinkedHashMap<String, Object>) n.getValue(), nodeTypes, dataNodes); + + } else if (n.getKey().contains(ToscaSchemaConstants.DATA_TYPES) && n.getValue() instanceof Map) { + + parseNodeAndDataType((LinkedHashMap<String, Object>) n.getValue(), nodeTypes, dataNodes); + + } else if (n.getKey().contains(ToscaSchemaConstants.POLICY_NODE)) { + + nodeTypes.put(n.getKey(), n.getValue()); + + } else if (n.getKey().contains(ToscaSchemaConstants.POLICY_DATA)) { + + dataNodes.put(n.getKey(), n.getValue()); + } + + }); + } + + @SuppressWarnings("unchecked") + private void populateJsonEditorObject(LinkedHashMap<String, Object> map, LinkedHashMap<String, Object> nodeTypes, + LinkedHashMap<String, Object> dataNodes, JSONObject jsonParentObject, JSONObject jsonTempObject) { + + Map<String, JSONObject> jsonEntrySchema = new HashMap(); + jsonParentObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_OBJECT); + nodeTypes.entrySet().stream().forEach(nt -> { + if (nt.getValue() instanceof Map) { + ((LinkedHashMap<String, Object>) nt.getValue()).entrySet().forEach(ntElement -> { + if (ntElement.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) { + JSONArray rootNodeArray = new JSONArray(); + if (ntElement.getValue() instanceof Map) { + ((LinkedHashMap<String, Object>) ntElement.getValue()).entrySet() + .forEach((ntPropertiesElement) -> { + boolean isListNode = false; + parseDescription((LinkedHashMap<String, Object>) ntPropertiesElement.getValue(), + jsonParentObject); + LinkedHashMap<String, Object> parentPropertiesMap = (LinkedHashMap<String, Object>) ntPropertiesElement + .getValue(); + if (parentPropertiesMap.containsKey(ToscaSchemaConstants.TYPE) + && ((String) parentPropertiesMap.get(ToscaSchemaConstants.TYPE)) + .contains(ToscaSchemaConstants.TYPE_LIST) + && parentPropertiesMap.containsKey(ToscaSchemaConstants.ENTRY_SCHEMA)) { + parentPropertiesMap = (LinkedHashMap<String, Object>) parentPropertiesMap + .get(ToscaSchemaConstants.ENTRY_SCHEMA); + isListNode = true; + } + if (parentPropertiesMap.containsKey(ToscaSchemaConstants.TYPE) + && ((String) parentPropertiesMap.get(ToscaSchemaConstants.TYPE)) + .contains(ToscaSchemaConstants.POLICY_DATA)) { + ((LinkedHashMap<String, Object>) dataNodes + .get(parentPropertiesMap.get(ToscaSchemaConstants.TYPE))).entrySet() + .stream().forEach(pmap -> { + if (pmap.getKey() + .equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) { + parseToscaProperties(ToscaSchemaConstants.POLICY_NODE, + (LinkedHashMap<String, Object>) pmap.getValue(), + jsonParentObject, rootNodeArray, jsonEntrySchema, dataNodes, + incrementSimpleTypeOrder()); + } + + }); + + } + if (isListNode) { + jsonTempObject.put(JsonEditorSchemaConstants.TYPE, + JsonEditorSchemaConstants.TYPE_ARRAY); + parseDescription((LinkedHashMap<String, Object>) ntPropertiesElement.getValue(), + jsonTempObject); + jsonTempObject.put(JsonEditorSchemaConstants.ITEMS, jsonParentObject); + jsonTempObject.put(JsonEditorSchemaConstants.FORMAT, + JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT_TABS_TOP); + jsonTempObject.put(JsonEditorSchemaConstants.UNIQUE_ITEMS, + JsonEditorSchemaConstants.TRUE); + } + }); + } + } + }); + } + }); + } + + @SuppressWarnings("unchecked") + private void parseToscaProperties(String parentKey, LinkedHashMap<String, Object> propertiesMap, + JSONObject jsonDataNode, JSONArray array, Map<String, JSONObject> jsonEntrySchema, + LinkedHashMap<String, Object> dataNodes, final int order) { + JSONObject jsonPropertyNode = new JSONObject(); + propertiesMap.entrySet().stream().forEach(p -> { + // Populate JSON Array for "required" key + + if (p.getValue() instanceof Map) { + LinkedHashMap<String, Object> nodeMap = (LinkedHashMap<String, Object>) p.getValue(); + if (nodeMap.containsKey(ToscaSchemaConstants.REQUIRED) + && ((boolean) nodeMap.get(ToscaSchemaConstants.REQUIRED))) { + array.put(p.getKey()); + } + // if(nodeMap.containsKey(ToscaSchemaConstants.CONSTRAINTS)) + parseToscaChildNodeMap(p.getKey(), nodeMap, jsonPropertyNode, jsonEntrySchema, dataNodes, array, + incrementSimpleTypeOrder()); + } + }); + jsonDataNode.put(JsonEditorSchemaConstants.REQUIRED, array); + jsonDataNode.put(JsonEditorSchemaConstants.PROPERTIES, jsonPropertyNode); + } + + @SuppressWarnings("unchecked") + private void parseToscaPropertiesForType(String parentKey, LinkedHashMap<String, Object> propertiesMap, + JSONObject jsonDataNode, JSONArray array, Map<String, JSONObject> jsonEntrySchema, + LinkedHashMap<String, Object> dataNodes, boolean isType, int order) { + JSONObject jsonPropertyNode = new JSONObject(); + + propertiesMap.entrySet().stream().forEach(p -> { + // array.put(p.getKey()); + boolean overWriteArray = false; + if (p.getValue() instanceof Map) { + LinkedHashMap<String, Object> nodeMap = (LinkedHashMap<String, Object>) p.getValue(); + if (!(parentKey.contains(ToscaSchemaConstants.ENTRY_SCHEMA) + || parentKey.contains(ToscaSchemaConstants.POLICY_NODE)) + && nodeMap.containsKey(ToscaSchemaConstants.TYPE) + && (((String) nodeMap.get(ToscaSchemaConstants.TYPE)).contains(ToscaSchemaConstants.POLICY_DATA))) { + overWriteArray = true; + } + if (nodeMap.containsKey(ToscaSchemaConstants.REQUIRED) + && ((boolean) nodeMap.get(ToscaSchemaConstants.REQUIRED))) { + array.put(p.getKey()); + } + parseToscaChildNodeMap(p.getKey(), nodeMap, jsonPropertyNode, jsonEntrySchema, dataNodes, array, order); + } + }); + jsonDataNode.put(JsonEditorSchemaConstants.REQUIRED, array); + jsonDataNode.put(JsonEditorSchemaConstants.PROPERTIES, jsonPropertyNode); + } + + private void parseToscaChildNodeMap(String childObjectKey, LinkedHashMap<String, Object> childNodeMap, + JSONObject jsonPropertyNode, Map<String, JSONObject> jsonEntrySchema, LinkedHashMap<String, Object> dataNodes, + JSONArray array, int order) { + JSONObject childObject = new JSONObject(); + // JSONArray childArray = new JSONArray(); + parseDescription(childNodeMap, childObject); + parseTypes(childObjectKey, childNodeMap, childObject, jsonEntrySchema, dataNodes, array, order); + parseConstraints(childNodeMap, childObject); + parseEntrySchema(childNodeMap, childObject, jsonPropertyNode, jsonEntrySchema, dataNodes); + + jsonPropertyNode.put(childObjectKey, childObject); + order++; + + } + + private void parseEntrySchema(LinkedHashMap<String, Object> childNodeMap, JSONObject childObject, + JSONObject jsonPropertyNode, Map<String, JSONObject> jsonEntrySchema, LinkedHashMap<String, Object> dataNodes) { + if (childNodeMap.get(ToscaSchemaConstants.ENTRY_SCHEMA) != null) { + if (childNodeMap.get(ToscaSchemaConstants.ENTRY_SCHEMA) instanceof Map) { + LinkedHashMap<String, Object> entrySchemaMap = (LinkedHashMap<String, Object>) childNodeMap + .get(ToscaSchemaConstants.ENTRY_SCHEMA); + entrySchemaMap.entrySet().stream().forEach(entry -> { + if (entry.getKey().equalsIgnoreCase(ToscaSchemaConstants.TYPE) && entry.getValue() != null) { + String entrySchemaType = (String) entry.getValue(); + if (entrySchemaType.contains(ToscaSchemaConstants.POLICY_DATA)) { + JSONArray array = new JSONArray(); + if (jsonEntrySchema.get(entrySchemaType) != null) { + // Already traversed + JSONObject entrySchemaObject = jsonEntrySchema.get(entrySchemaType); + attachEntrySchemaJsonObject(childObject, entrySchemaObject, + JsonEditorSchemaConstants.TYPE_OBJECT); + } else if (dataNodes.containsKey(entrySchemaType)) { + + JSONObject entrySchemaObject = new JSONObject(); + // Need to traverse + ((LinkedHashMap<String, Object>) dataNodes.get(entrySchemaType)).entrySet().stream() + .forEach(pmap -> { + if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) { + parseToscaProperties(ToscaSchemaConstants.ENTRY_SCHEMA, + (LinkedHashMap<String, Object>) pmap.getValue(), entrySchemaObject, + array, jsonEntrySchema, dataNodes, incrementComplexTypeOrder()); + jsonEntrySchema.put(entrySchemaType, entrySchemaObject); + dataNodes.remove(entrySchemaType); + attachEntrySchemaJsonObject(childObject, entrySchemaObject, + JsonEditorSchemaConstants.TYPE_OBJECT); + } + + }); + } + } else if (entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING) + || entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER) + || entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_FLOAT)) { + JSONObject entrySchemaObject = new JSONObject(); + parseConstraints(entrySchemaMap, entrySchemaObject); + String jsontype = JsonEditorSchemaConstants.TYPE_STRING; + if (entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER) + || entrySchemaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_FLOAT)) { + jsontype = JsonEditorSchemaConstants.TYPE_INTEGER; + } + if (childNodeMap.get(ToscaSchemaConstants.TYPE) != null) { + // Only known value of type is String for now + if (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String) { + String typeValue = (String) childNodeMap.get(ToscaSchemaConstants.TYPE); + if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) { + // Custom key for JSON Editor and UI rendering + childObject.put(JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT, + JsonEditorSchemaConstants.FORMAT_SELECT); + // childObject.put(JsonEditorSchemaConstants.UNIQUE_ITEMS, + // JsonEditorSchemaConstants.TRUE); + } + } + } + attachEntrySchemaJsonObject(childObject, entrySchemaObject, jsontype); + } + } + }); + } + } + } + + private void attachEntrySchemaJsonObject(JSONObject childObject, JSONObject entrySchemaObject, String dataType) { + + entrySchemaObject.put(JsonEditorSchemaConstants.TYPE, dataType); + childObject.put(JsonEditorSchemaConstants.ITEMS, entrySchemaObject); + } + + @SuppressWarnings("unchecked") + private void attachTypeJsonObject(JSONObject childObject, JSONObject typeObject) { + Iterator<String> keys = typeObject.keys(); + while (keys.hasNext()) { + String key = keys.next(); + childObject.put(key, typeObject.get(key)); + } + } + + /* + * private String parseKey(String toscaKey, String lookupString) { return + * toscaKey.substring(toscaKey.indexOf(lookupString) + lookupString.length(), + * toscaKey.length()); } + */ + + private void parseDescription(LinkedHashMap<String, Object> childNodeMap, JSONObject childObject) { + if (childNodeMap.get(ToscaSchemaConstants.DESCRIPTION) != null) { + childObject.put(JsonEditorSchemaConstants.TITLE, childNodeMap.get(ToscaSchemaConstants.DESCRIPTION)); + } + } + + private void parseTypes(String childObjectKey, LinkedHashMap<String, Object> childNodeMap, JSONObject childObject, + Map<String, JSONObject> jsonEntrySchema, LinkedHashMap<String, Object> dataNodes, JSONArray array, int order) { + if (childNodeMap.get(ToscaSchemaConstants.TYPE) != null) { + // Only known value of type is String for now + if (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String) { + childObject.put(JsonEditorSchemaConstants.PROPERTY_ORDER, order); + String typeValue = (String) childNodeMap.get(ToscaSchemaConstants.TYPE); + if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)) { + childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_INTEGER); + + } else if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_FLOAT)) { + childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_INTEGER); + } else if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) { + childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_ARRAY); + // Custom key for JSON Editor and UI rendering + childObject.put(JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT, + JsonEditorSchemaConstants.CUSTOM_KEY_FORMAT_TABS_TOP); + childObject.put(JsonEditorSchemaConstants.UNIQUE_ITEMS, JsonEditorSchemaConstants.TRUE); + } else if (typeValue.equalsIgnoreCase(ToscaSchemaConstants.TYPE_MAP)) { + childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_OBJECT); + } else if (typeValue.contains(ToscaSchemaConstants.POLICY_DATA)) { + JSONArray childArray = new JSONArray(); + + if (jsonEntrySchema.get(typeValue) != null) { + // Already traversed + JSONObject entrySchemaObject = jsonEntrySchema.get(typeValue); + attachTypeJsonObject(childObject, entrySchemaObject); + } else if (dataNodes.containsKey(typeValue)) { + JSONObject entrySchemaObject = new JSONObject(); + // Need to traverse + JSONArray jsonArray = new JSONArray(); + ((LinkedHashMap<String, Object>) dataNodes.get(typeValue)).entrySet().stream().forEach(pmap -> { + if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) { + + ((LinkedHashMap<String, Object>) pmap.getValue()).entrySet().stream().forEach(p -> { + if (p.getValue() instanceof Map) { + LinkedHashMap<String, Object> childNodeMap2 = (LinkedHashMap<String, Object>) p + .getValue(); + if (childNodeMap2.containsKey(ToscaSchemaConstants.TYPE) + && (((String) childNodeMap2.get(ToscaSchemaConstants.TYPE)) + .contains(ToscaSchemaConstants.POLICY_DATA))) { + } + } + }); + } + }); + ((LinkedHashMap<String, Object>) dataNodes.get(typeValue)).entrySet().stream().forEach(pmap -> { + if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) { + parseToscaPropertiesForType(childObjectKey, + (LinkedHashMap<String, Object>) pmap.getValue(), entrySchemaObject, childArray, + jsonEntrySchema, dataNodes, true, incrementComplexSimpleTypeOrder()); + jsonEntrySchema.put(typeValue, entrySchemaObject); + dataNodes.remove(typeValue); + attachTypeJsonObject(childObject, entrySchemaObject); + } + }); + } + } else { + childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_STRING); + } + } + if (childNodeMap.get(ToscaSchemaConstants.DEFAULT) != null) { + childObject.put(JsonEditorSchemaConstants.DEFAULT, childNodeMap.get(ToscaSchemaConstants.DEFAULT)); + } + } + } + + private void parseConstraints(LinkedHashMap<String, Object> childNodeMap, JSONObject childObject) { + if (childNodeMap.containsKey(ToscaSchemaConstants.CONSTRAINTS) + && childNodeMap.get(ToscaSchemaConstants.CONSTRAINTS) != null) { + List<LinkedHashMap<String, Object>> constraintsList = (List<LinkedHashMap<String, Object>>) childNodeMap + .get(ToscaSchemaConstants.CONSTRAINTS); + constraintsList.stream().forEach(c -> { + if (c instanceof Map) { + c.entrySet().stream().forEach(constraint -> { + if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.MIN_LENGTH) + || constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.GREATER_OR_EQUAL)) { + // For String min_lenghth is minimum length whereas for number, it will be + // minimum or greater than to the defined value + if (childNodeMap.containsKey(ToscaSchemaConstants.TYPE) + && (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String) + && ((String) childNodeMap.get(ToscaSchemaConstants.TYPE)) + .equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) { + childObject.put(JsonEditorSchemaConstants.MIN_LENGTH, constraint.getValue()); + } else { + childObject.put(JsonEditorSchemaConstants.MINIMUM, constraint.getValue()); + } + } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.MAX_LENGTH) + || constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.LESS_OR_EQUAL)) { + // For String max_lenghth is maximum length whereas for number, it will be + // maximum or less than the defined value + if (childNodeMap.containsKey(ToscaSchemaConstants.TYPE) + && (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String) + && ((String) childNodeMap.get(ToscaSchemaConstants.TYPE)) + .equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) { + childObject.put(JsonEditorSchemaConstants.MAX_LENGTH, constraint.getValue()); + } else { + childObject.put(JsonEditorSchemaConstants.MAXIMUM, constraint.getValue()); + } + } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.LESS_THAN)) { + childObject.put(JsonEditorSchemaConstants.EXCLUSIVE_MAXIMUM, constraint.getValue()); + } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.GREATER_THAN)) { + childObject.put(JsonEditorSchemaConstants.EXCLUSIVE_MINIMUM, constraint.getValue()); + } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.IN_RANGE)) { + if (constraint.getValue() instanceof ArrayList<?>) { + if (childNodeMap.containsKey(ToscaSchemaConstants.TYPE) + && (childNodeMap.get(ToscaSchemaConstants.TYPE) instanceof String) + && ((String) childNodeMap.get(ToscaSchemaConstants.TYPE)) + .equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) { + childObject.put(JsonEditorSchemaConstants.MIN_LENGTH, + ((ArrayList) constraint.getValue()).get(0)); + childObject.put(JsonEditorSchemaConstants.MAX_LENGTH, + ((ArrayList) constraint.getValue()).get(1)); + } else { + childObject.put(JsonEditorSchemaConstants.MINIMUM, + ((ArrayList) constraint.getValue()).get(0)); + childObject.put(JsonEditorSchemaConstants.MAXIMUM, + ((ArrayList) constraint.getValue()).get(1)); + } + + } + } else if (constraint.getKey().equalsIgnoreCase(ToscaSchemaConstants.VALID_VALUES)) { + JSONArray validValuesArray = new JSONArray(); + + if (constraint.getValue() instanceof ArrayList<?>) { + boolean processDictionary = ((ArrayList<?>) constraint.getValue()).stream() + .anyMatch(value -> (value instanceof String + && ((String) value).contains(ToscaSchemaConstants.DICTIONARY))); + if (!processDictionary) { + ((ArrayList<?>) constraint.getValue()).stream().forEach(value -> { + validValuesArray.put(value); + }); + childObject.put(JsonEditorSchemaConstants.ENUM, validValuesArray); + } else { + ((ArrayList<?>) constraint.getValue()).stream().forEach(value -> { + if ((value instanceof String + && ((String) value).contains(ToscaSchemaConstants.DICTIONARY))) { + processDictionaryElements(childObject, (String) value); + } + + }); + + } + } + + } + }); + } + }); + } + } + + private void processDictionaryElements(JSONObject childObject, String dictionaryReference) { + + if (dictionaryReference.contains("#")) { + String[] dictionaryKeyArray = dictionaryReference + .substring(dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11, + dictionaryReference.length()) + .split("#"); + // We support only one # as of now. + List<CldsDictionaryItem> cldsDictionaryElements = null; + List<CldsDictionaryItem> subDictionaryElements = null; + if (dictionaryKeyArray != null && dictionaryKeyArray.length == 2) { + cldsDictionaryElements = getCldsDao().getDictionaryElements(dictionaryKeyArray[0], null, null); + subDictionaryElements = getCldsDao().getDictionaryElements(dictionaryKeyArray[1], null, null); + + if (cldsDictionaryElements != null) { + List<String> subCldsDictionaryNames = subDictionaryElements.stream() + .map(CldsDictionaryItem::getDictElementShortName).collect(Collectors.toList()); + JSONArray jsonArray = new JSONArray(); + + Optional.ofNullable(cldsDictionaryElements).get().stream().forEach(c -> { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(JsonEditorSchemaConstants.TYPE, getJsonType(c.getDictElementType())); + if (c.getDictElementType() != null + && c.getDictElementType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) { + jsonObject.put(JsonEditorSchemaConstants.MIN_LENGTH, 1); + } + jsonObject.put(JsonEditorSchemaConstants.ID, c.getDictElementName()); + jsonObject.put(JsonEditorSchemaConstants.LABEL, c.getDictElementShortName()); + jsonObject.put(JsonEditorSchemaConstants.OPERATORS, subCldsDictionaryNames); + jsonArray.put(jsonObject); + }); + ; + JSONObject filterObject = new JSONObject(); + filterObject.put(JsonEditorSchemaConstants.FILTERS, jsonArray); + + childObject.put(JsonEditorSchemaConstants.TYPE, JsonEditorSchemaConstants.TYPE_QBLDR); + // TO invoke validation on such parameters + childObject.put(JsonEditorSchemaConstants.MIN_LENGTH, 1); + childObject.put(JsonEditorSchemaConstants.QSSCHEMA, filterObject); + + } + } + } else { + String dictionaryKey = dictionaryReference.substring( + dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11, dictionaryReference.length()); + if (dictionaryKey != null) { + List<CldsDictionaryItem> cldsDictionaryElements = getCldsDao().getDictionaryElements(dictionaryKey, + null, null); + if (cldsDictionaryElements != null) { + List<String> cldsDictionaryNames = new ArrayList<>(); + List<String> cldsDictionaryFullNames = new ArrayList<>(); + cldsDictionaryElements.stream().forEach(c -> { + // Json type will be translated before Policy creation + if (c.getDictElementType() != null && !c.getDictElementType().equalsIgnoreCase("json")) { + cldsDictionaryFullNames.add(c.getDictElementName()); + } + cldsDictionaryNames.add(c.getDictElementShortName()); + }); + + if (cldsDictionaryFullNames.size() > 0) { + childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryFullNames); + // Add Enum titles for generated translated values during JSON instance + // generation + JSONObject enumTitles = new JSONObject(); + enumTitles.put(JsonEditorSchemaConstants.ENUM_TITLES, cldsDictionaryNames); + childObject.put(JsonEditorSchemaConstants.OPTIONS, enumTitles); + } else { + childObject.put(JsonEditorSchemaConstants.ENUM, cldsDictionaryNames); + } + + } + } + } + } + + private String getJsonType(String toscaType) { + String jsonType = null; + if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_INTEGER)) { + jsonType = JsonEditorSchemaConstants.TYPE_INTEGER; + } else if (toscaType.equalsIgnoreCase(ToscaSchemaConstants.TYPE_LIST)) { + jsonType = JsonEditorSchemaConstants.TYPE_ARRAY; + } else { + jsonType = JsonEditorSchemaConstants.TYPE_STRING; + } + return jsonType; + } + +}
\ No newline at end of file diff --git a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java index 759edb1d9..300d60663 100644 --- a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java +++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java @@ -176,6 +176,7 @@ public class LoggingUtils { * @return this.
*/
public void entering(HttpServletRequest request, String serviceName) {
+ MDC.clear();
checkNotNull(request);
// Extract MDC values from standard HTTP headers.
final String requestID = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));
@@ -205,6 +206,8 @@ public class LoggingUtils { if (serviceName == null ||
serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
+ } else {
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);
}
this.mLogger.info(ONAPLogConstants.Markers.ENTRY);
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties index 0ce8a7b65..2d34fba7b 100644 --- a/src/main/resources/application-noaaf.properties +++ b/src/main/resources/application-noaaf.properties @@ -82,7 +82,7 @@ camel.springboot.xmlRests=classpath:/clds/camel/rest/*.xml #clds datasource connection details spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver -spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3 +spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3 spring.datasource.cldsdb.username=clds spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067 spring.datasource.cldsdb.validationQuery=SELECT 1 @@ -101,10 +101,10 @@ async.max.pool.size=20 async.queue.capacity=500 #For EELF logback file -#com.att.eelf.logging.path= +#clamp.config.logback.path= clamp.config.logback.filename=logback-default.xml #The log folder that will be used in logback.xml file -clamp.config.log.path=/var/log/ONAP/clamp +clamp.config.log.path=/var/log/onap/clamp clamp.config.files.systemProperties=classpath:/system.properties clamp.config.files.cldsUsers=classpath:/clds/clds-users.json clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json @@ -114,7 +114,6 @@ clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json # DCAE request build properties # clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json -clamp.config.dcae.decode.service_ids=classpath:/clds/templates/dcae-decode-service_ids.json clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json # # SDC request blueprint properties @@ -148,6 +147,9 @@ clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_ clamp.config.policy.base.policyNamePrefix=Config_ clamp.config.policy.op.type=BRMS_Param +clamp.config.import.tosca.model=true +clamp.config.tosca.policyTypes=tca +clamp.config.tosca.filePath=/tmp/tosca-models # TCA MicroService Policy request build properties # @@ -160,7 +162,7 @@ clamp.config.tca.thresholds.template=classpath:/clds/templates/tca-thresholds-te # # Operational Policy request build properties # -clamp.config.op.policyDescription=from clds +clamp.config.op.policyDescription=from CLAMP # default clamp.config.op.templateName=ClosedLoopControlName clamp.config.op.operationTopic=APPC-CL @@ -186,7 +188,6 @@ clamp.config.sdc.csarFolder = /tmp/sdc-controllers clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json # clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json -clamp.config.ui.alarm.default=classpath:/clds/templates/ui-alarm-default.json # # if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request clamp.config.action.test.override=false @@ -214,3 +215,4 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal
\ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 263c09d35..c492f74de 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -99,7 +99,7 @@ camel.springboot.xmlRests=classpath:/clds/camel/rest/*.xml #clds datasource connection details spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver -spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3 +spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3 spring.datasource.cldsdb.username=clds spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067 spring.datasource.cldsdb.validationQuery=SELECT 1 @@ -121,7 +121,7 @@ async.queue.capacity=500 #clamp.config.logback.path= clamp.config.logback.filename=logback-default.xml #The log folder that will be used in logback.xml file -clamp.config.log.path=/var/log/ONAP/clamp +clamp.config.log.path=/var/log/onap/clamp clamp.config.files.systemProperties=classpath:/system.properties clamp.config.files.cldsUsers=classpath:/clds/clds-users.json clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json @@ -131,7 +131,6 @@ clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json # DCAE request build properties # clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json -clamp.config.dcae.decode.service_ids=classpath:/clds/templates/dcae-decode-service_ids.json clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json # # SDC request blueprint properties @@ -165,6 +164,9 @@ clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_ clamp.config.policy.base.policyNamePrefix=Config_ clamp.config.policy.op.type=BRMS_Param +clamp.config.import.tosca.model=true +clamp.config.tosca.policyTypes=tca +clamp.config.tosca.filePath=/tmp/tosca-models # TCA MicroService Policy request build properties # @@ -203,7 +205,6 @@ clamp.config.sdc.csarFolder = /tmp/sdc-controllers clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json # clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json -clamp.config.ui.alarm.default=classpath:/clds/templates/ui-alarm-default.json # # if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request clamp.config.action.test.override=false @@ -231,6 +232,7 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties clamp.config.security.permission.instance=dev +clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal #AAF related parameters clamp.config.cadi.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile diff --git a/src/main/resources/clds/camel/rest/clds-services.xml b/src/main/resources/clds/camel/rest/clds-services.xml index e67fb162d..476816977 100644 --- a/src/main/resources/clds/camel/rest/clds-services.xml +++ b/src/main/resources/clds/camel/rest/clds-services.xml @@ -4,7 +4,7 @@ outType="org.onap.clamp.clds.model.CldsMonitoringDetails" produces="application/json"> <to - uri="bean:org.onap.clamp.clds.service.CldsService?method=getCLDSDetails()" /> + uri="bean:org.onap.clamp.clds.service.CldsService?method=getCldsDetails()" /> </get> <get uri="/clds/cldsInfo" outType="org.onap.clamp.clds.model.CldsInfo" diff --git a/src/main/resources/clds/templates/dcae-decode-service_ids.json b/src/main/resources/clds/templates/dcae-decode-service_ids.json deleted file mode 100644 index 619cac67a..000000000 --- a/src/main/resources/clds/templates/dcae-decode-service_ids.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "vUSP": [ - "vUSP - vCTS" - ], - "Trinity": [ - "ASBGv TLS VNF", - "ASBGv No TLS", - "ASBGv (NO TLS) VNF", - "ASBGv TLS", - "NSBGv VNF", - "NSBGv" - ], - "vSCP": [ - "AKRON_vSCP_F5_FW-SVC/vSCP_F5_FW 1", - "ALLEN_vSCP_F5_FW-SVC/vSCP_F5_FW 1" - ], - "vProbes": [ - "vProbes - FW" - ] -} diff --git a/src/main/resources/clds/templates/ui-alarm-default.json b/src/main/resources/clds/templates/ui-alarm-default.json deleted file mode 100644 index c851e6cdd..000000000 --- a/src/main/resources/clds/templates/ui-alarm-default.json +++ /dev/null @@ -1,597 +0,0 @@ -{ - "Reports a transient alarm condition when an incoming CDR cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming CDR cannot be decoded successfully", - "Reports a transient alarm condition when an incoming ACR message cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming ACR message cannot be decoded successfully", - "Reports a transient alarm condition when a CDR validation fails": "vCCF: Reports a transient alarm condition when a CDR validation fails", - "Reports a transient alarm condition when an incoming GTP' message cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming GTP' message cannot be decoded successfully", - "Reports a transient alarm condition when an incoming CDR file cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming CDR file cannot be decoded successfully", - "Reports a transient alarm condition when an incoming Sh/Dh file cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming Sh/Dh file cannot be decoded successfully", - "Reports a transient alarm condition when an incoming ACR message is in conflict with former ACR in one diameter session": "vCCF: Reports a transient alarm condition when an incoming ACR message is in conflict with former ACR in one diameter session", - "Reports a transient alarm condition when an outgoing Ro message send fails": "vCCF: Reports a transient alarm condition when an outgoing Ro message send fails", - "Reports a transient alarm condition when an outgoing GTP' message send fails": "vCCF: Reports a transient alarm condition when an outgoing GTP' message send fails", - "Reports a transient alarm condition when an outgoing Sh/Dh message send fails": "vCCF: Reports a transient alarm condition when an outgoing Sh/Dh message send fails", - "Reports an alarm when build or send Rf message fail": "vCCF: Reports an alarm when build or send Rf message fail", - "Reports a transient alarm condition when an abnormal incoming CCA message": "vCCF: Reports a transient alarm condition when an abnormal incoming CCA message", - "Reports a transient alarm condition when there is an abnormal incoming Sh/Dh message": "vCCF: Reports a transient alarm condition when there is an abnormal incoming Sh/Dh message", - "For Rf interface, if IeCCF receives a message with incorrect value for session id.": "vCCF: For Rf interface, if IeCCF receives a message with incorrect value for session id.", - "Reports an alarm when CPU usage exceeds the major threshold, the local database exceeds the critical threshold, or the ACR partition exceeds the major threshold": "vCCF: Reports an alarm when CPU usage exceeds the major threshold, the local database exceeds the critical threshold, or the ACR partition exceeds the major threshold", - "Reports an alarm when CPU usage exceeds the minor threshold, the local database exceeds the major threshold, or the ACR partition exceeds the minor threshold": "vCCF: Reports an alarm when CPU usage exceeds the minor threshold, the local database exceeds the major threshold, or the ACR partition exceeds the minor threshold", - "Reports an alarm when CPU usage exceeds the critical threshold, the local database exceeds the major threshold, or the CDR partition exceeds the critical threshold": "vCCF: Reports an alarm when CPU usage exceeds the critical threshold, the local database exceeds the major threshold, or the CDR partition exceeds the critical threshold", - "Reports an alarm when CPU usage exceeds the major threshold or CDR partition exceeds the major threshold": "vCCF: Reports an alarm when CPU usage exceeds the major threshold or CDR partition exceeds the major threshold", - "Reports an alarm when external DB usage exceeds the major threshold": "vCCF: Reports an alarm when external DB usage exceeds the major threshold", - "Reports a transient alarm condition when the workflow definition table is provisioned wrongly": "vCCF: Reports a transient alarm condition when the workflow definition table is provisioned wrongly", - "Reports a transient alarm condition when the Action Definition table is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Action Definition table is provisioned wrongly", - "Reports a transient alarm condition when the Ro Host Configuration is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Ro Host Configuration is provisioned wrongly", - "Reports a transient alarm condition when the Sh Host Configuration is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Sh Host Configuration is provisioned wrongly", - "Reports a transient alarm condition when a specific dictionary or rule does not exist": "vCCF: Reports a transient alarm condition when a specific dictionary or rule does not exist", - "Reports a transient alarm condition when failure occurs when mapping Rf message to XDR": "vCCF: Reports a transient alarm condition when failure occurs when mapping Rf message to XDR", - "Reports a transient alarm condition when failure occurs in aggregating process": "vCCF: Reports a transient alarm condition when failure occurs in aggregating process", - "Reports a transient alarm condition when failure happens in correlating process": "vCCF: Reports a transient alarm condition when failure happens in correlating process", - "Reports a transient alarm condition when failure occurs in generating CDR": "vCCF: Reports a transient alarm condition when failure occurs in generating CDR", - "Reports a transient alarm condition when failure occurs in constructing CCR message from XDR": "vCCF: Reports a transient alarm condition when failure occurs in constructing CCR message from XDR", - "Reports a transient alarm condition when an ACR/XER/BER/INC record write to bad file": "vCCF: Reports a transient alarm condition when an ACR/XER/BER/INC record write to bad file", - "Reports an alarm condition when aggregation or correlation central database connection is lost": "vCCF: Reports an alarm condition when aggregation or correlation central database connection is lost", - "Reports an alarm condition when a specific failure happens in database operations": "vCCF: Reports an alarm condition when a specific failure happens in database operations", - "Reports an alarm condition when DB capacity has been consumed to critical threshold": "vCCF: Reports an alarm condition when DB capacity has been consumed to critical threshold", - "Reports an alarm condition when DB capacity has been consumed to major threshold": "vCCF: Reports an alarm condition when DB capacity has been consumed to major threshold", - "Reports an alarm condition when DB capacity has been consumed to minor threshold.": "vCCF: Reports an alarm condition when DB capacity has been consumed to minor threshold.", - "Reports an alarm condition when application cannot deliver CDR to CDRSCH subsystem": "vCCF: Reports an alarm condition when application cannot deliver CDR to CDRSCH subsystem", - "Reports an alarm condition when some fields of ACR file header have error value and this ACR file cannot be processed further": "vCCF: Reports an alarm condition when some fields of ACR file header have error value and this ACR file cannot be processed further", - "Reports an alarm condition when some fields of ACR file header have invalid value and this ACR file can be processed further": "vCCF: Reports an alarm condition when some fields of ACR file header have invalid value and this ACR file can be processed further", - "Reports an alarm condition when the ACR file loses some ACR records": "vCCF: Reports an alarm condition when the ACR file loses some ACR records", - "Reports an alarm condition when some fields of ACR record header have error value and this ACR record and the following ACR records cannot be processed further": "vCCF: Reports an alarm condition when some fields of ACR record header have error value and this ACR record and the following ACR records cannot be processed further", - "Reports an alarm condition when error occurs in processing CDR/ACR files": "vCCF: Reports an alarm condition when error occurs in processing CDR/ACR files", - "Reports an alarm condition when CDR partition has been consumed to critical threshold": "vCCF: Reports an alarm condition when CDR partition has been consumed to critical threshold", - "Reports an alarm condition when CDR partition has been consumed to major threshold.": "vCCF: Reports an alarm condition when CDR partition has been consumed to major threshold.", - "Reports an alarm condition when CDR partition has been consumed to minor threshold": "vCCF: Reports an alarm condition when CDR partition has been consumed to minor threshold", - "Reports an alarm condition when ACR partition has been consumed to critical threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to critical threshold", - "Reports an alarm condition when ACR partition has been consumed to major threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to major threshold", - "Reports an alarm condition when ACR partition has been consumed to minor threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to minor threshold", - "Reports an alarm condition when CPU consumption reaches critical threshold": "vCCF: Reports an alarm condition when CPU consumption reaches critical threshold", - "Reports an alarm condition when CPU consumption reaches major threshold": "vCCF: Reports an alarm condition when CPU consumption reaches major threshold", - "Reports an alarm condition when CPU consumption reaches minor threshold": "vCCF: Reports an alarm condition when CPU consumption reaches minor threshold", - "Service shall monitor * number of partial CDR * number of incompleted CDR * number of unacceptable CDR If any one exceeds a configurable threshold in a configrable interval.": "vCCF: Service shall monitor * number of partial CDR * number of incompleted CDR * number of unacceptable CDR If any one exceeds a configurable threshold in a configrable interval.", - "CDR size exceed the platform capacity.": "vCCF: CDR size exceed the platform capacity.", - "Service shall monitor number of ACR without AII AVP, If it exceeds a configurable threshold in a configurable interval.": "vCCF: Service shall monitor number of ACR without AII AVP, If it exceeds a configurable threshold in a configurable interval.", - "Service shall monitor CDR cut due to ECCF_ACRNUMBER_IN_DB, If it exceeds a configurable threshold in a configurable interval.": "vCCF: Service shall monitor CDR cut due to ECCF_ACRNUMBER_IN_DB, If it exceeds a configurable threshold in a configurable interval.", - "External Node of this Cluster is overload": "vCCF: External Node of this Cluster is overload", - "bdb_high_latency": "vCCF-vDB: bdb_high_latency", - "bdb_high_throughput": "vCCF-vDB: bdb_high_throughput", - "bdb_size": "vCCF-vDB: bdb_size", - "cluster_inconsistent_rl_sw": "vCCF-vDB: cluster_inconsistent_rl_sw", - "cluster_node_remove_abort_failed": "vCCF-vDB: cluster_node_remove_abort_failed", - "cluster_node_remove_failed": "vCCF-vDB: cluster_node_remove_failed", - "cluster_ram_overcommit": "vCCF-vDB: cluster_ram_overcommit", - "cluster_rebalance_failed": "vCCF-vDB: cluster_rebalance_failed", - "cluster_too_few_nodes_for_replication": "vCCF-vDB: cluster_too_few_nodes_for_replication", - "node_cpu_utilization": "vCCF-vDB: node_cpu_utilization", - "node_ephemeral_storage": "vCCF-vDB: node_ephemeral_storage", - "node_failed": "vCCF-vDB: node_failed", - "node_memory": "vCCF-vDB: node_memory", - "node_net_throughput": "vCCF-vDB: node_net_throughput", - "node_offline_failed": "vCCF-vDB: node_offline_failed", - "node_offline_abort_failed": "vCCF-vDB: node_offline_abort_failed", - "node_online_failed": "vCCF-vDB: node_online_failed", - "OAM NODE-<OAME-hostname> IS NOT ACTIVE ": "vCCF-vDB: OAM NODE-<OAME-hostname> IS NOT ACTIVE ", - "LSS_asdaCommunicationFailure": "vCTS: LSS_asdaCommunicationFailure", - "LSS_ccdbCommunicationFailure": "vCTS: LSS_ccdbCommunicationFailure", - "LSS_cpiCTS3xxFailRate": "vCTS: LSS_cpiCTS3xxFailRate", - "LSS_cpiCTS4xxFailRate": "vCTS: LSS_cpiCTS4xxFailRate", - "LSS_cpiCTS5xxFailRate": "vCTS: LSS_cpiCTS5xxFailRate", - "LSS_cpiCTS6xxFailRate": "vCTS: LSS_cpiCTS6xxFailRate", - "LSS_cpiCTSSIPRetransmitInvite": "vCTS: LSS_cpiCTSSIPRetransmitInvite", - "LSS_cpiCTSSIPRetransmitNonInvite": "vCTS: LSS_cpiCTSSIPRetransmitNonInvite", - "LSS_glsInvalidCellId": "vCTS: LSS_glsInvalidCellId", - "LSS_glsServerUnavailable": "vCTS: LSS_glsServerUnavailable", - "LSS_hlrSyncConnection": "vCTS: LSS_hlrSyncConnection", - "LSS_hlrSyncQueue": "vCTS: LSS_hlrSyncQueue", - "LSS_lispBufferFullExternalLIG": "vCTS: LSS_lispBufferFullExternalLIG", - "LSS_prdbConnectWithAlternateFailure": "vCTS: LSS_prdbConnectWithAlternateFailure", - "LSS_prdbSyncDataToAlternateFailure": "vCTS: LSS_prdbSyncDataToAlternateFailure", - "LSS_preAllocatedResourceOverload": "vCTS: LSS_preAllocatedResourceOverload", - "LSS_prifSocketError": "vCTS: LSS_prifSocketError", - "LSS_prsCallInstanceExceeded": "vCTS: LSS_prsCallInstanceExceeded", - "LSS_prsCpuOverload": "vCTS: LSS_prsCpuOverload", - "LSS_prsDatabaseMigrationFailure": "vCTS: LSS_prsDatabaseMigrationFailure", - "LSS_prsFailureToConnectWithPRDB": "vCTS: LSS_prsFailureToConnectWithPRDB", - "LSS_prsQueueExceeded": "vCTS: LSS_prsQueueExceeded", - "LSS_smdiSocketError": "vCTS: LSS_smdiSocketError", - "LSS_socketError": "vCTS: LSS_socketError", - "LSS_softwareComponentDown": "vCTS: LSS_softwareComponentDown", - "LSS_tlsInitError": "vCTS: LSS_tlsInitError", - "LSS_usageOfSyncTable": "vCTS: LSS_usageOfSyncTable", - "LSS_utHttpProxyConnectionDown ": "vCTS: LSS_utHttpProxyConnectionDown ", - "LSS_wpifSocketError": "vCTS: LSS_wpifSocketError", - "LSS_acrTemporaryBufferOverload": "vCTS: LSS_acrTemporaryBufferOverload", - "LSS_adnsExtendedTTLcaching": "vCTS: LSS_adnsExtendedTTLcaching", - "LSS_adnsQueryFailureCaching": "vCTS: LSS_adnsQueryFailureCaching", - "LSS_adnsQueueCongestion": "vCTS: LSS_adnsQueueCongestion", - "LSS_asdaRequestQueue": "vCTS: LSS_asdaRequestQueue", - "LSS_capacityLicenseKeyExpiration": "vCTS: LSS_capacityLicenseKeyExpiration", - "LSS_capacityLicenseKeyNearExpiration": "vCTS: LSS_capacityLicenseKeyNearExpiration", - "LSS_capacityLicenseKeyValidationError": "vCTS: LSS_capacityLicenseKeyValidationError", - "LSS_cardConnectionLost": "vCTS: LSS_cardConnectionLost", - "LSS_cpiAlrmCritical": "vCTS: LSS_cpiAlrmCritical", - "LSS_cpiAlrmMajor": "vCTS: LSS_cpiAlrmMajor", - "LSS_cpiAlrmMinor": "vCTS: LSS_cpiAlrmMinor", - "LSS_cpiAlrmWarning": "vCTS: LSS_cpiAlrmWarning", - "LSS_cpiAsrtEsc": "vCTS: LSS_cpiAsrtEsc", - "LSS_cpiAsrtNonEsc": "vCTS: LSS_cpiAsrtNonEsc", - "LSS_cpiAsrtNonEscCritical": "vCTS: LSS_cpiAsrtNonEscCritical", - "LSS_cpiAsrtNonEscMajor": "vCTS: LSS_cpiAsrtNonEscMajor", - "LSS_cpiAsrtNonEscMinor": "vCTS: LSS_cpiAsrtNonEscMinor", - "LSS_cpiAudErrCount": "vCTS: LSS_cpiAudErrCount", - "LSS_cpiAudManAct": "vCTS: LSS_cpiAudManAct", - "LSS_cpiAudNewEvent": "vCTS: LSS_cpiAudNewEvent", - "LSS_cpiCompleteRateAlarm": "vCTS: LSS_cpiCompleteRateAlarm", - "LSS_cpiDropMGAllocConnReq": "vCTS: LSS_cpiDropMGAllocConnReq", - "LSS_cpiDropRateAlarm": "vCTS: LSS_cpiDropRateAlarm", - "LSS_cpiExceptionService": "vCTS: LSS_cpiExceptionService", - "LSS_cpiFailRateAlarm": "vCTS: LSS_cpiFailRateAlarm", - "LSS_cpiFailSCTPFastRetransIncr": "vCTS: LSS_cpiFailSCTPFastRetransIncr", - "LSS_cpiFailSCTPFastRetransRate": "vCTS: LSS_cpiFailSCTPFastRetransRate", - "LSS_cpiFailSCTPSRTT1Incr": "vCTS: LSS_cpiFailSCTPSRTT1Incr", - "LSS_cpiFailSCTPSRTT2Incr": "vCTS: LSS_cpiFailSCTPSRTT2Incr", - "LSS_cpiFailSCTPT3RetransIncr": "vCTS: LSS_cpiFailSCTPT3RetransIncr", - "LSS_cpiFailSCTPT3RetransRate": "vCTS: LSS_cpiFailSCTPT3RetransRate", - "LSS_cpiFileSysUsage": "vCTS: LSS_cpiFileSysUsage", - "LSS_cpiMemAllocFail": "vCTS: LSS_cpiMemAllocFail", - "LSS_cpiNumOfLICDRDel": "vCTS: LSS_cpiNumOfLICDRDel", - "LSS_cpiReinitServiceSelf": "vCTS: LSS_cpiReinitServiceSelf", - "LSS_cpiSIPRetransmitInvite": "vCTS: LSS_cpiSIPRetransmitInvite", - "LSS_cpiSIPRetransmitNonInvite": "vCTS: LSS_cpiSIPRetransmitNonInvite", - "LSS_cpiSS7DropSCTPPktsRcvd": "vCTS: LSS_cpiSS7DropSCTPPktsRcvd", - "LSS_cpiSS7FailSCTPFastRetransRate": "vCTS: LSS_cpiSS7FailSCTPFastRetransRate", - "LSS_cpiStabilityAlarm": "vCTS: LSS_cpiStabilityAlarm", - "LSS_cpuOverload": "vCTS: LSS_cpuOverload", - "LSS_databaseConnectionLost": "vCTS: LSS_databaseConnectionLost", - "LSS_databaseReplicationLinkDown": "vCTS: LSS_databaseReplicationLinkDown", - "LSS_databaseSizeExhausted": "vCTS: LSS_databaseSizeExhausted", - "LSS_dbHighCpuUtilization": "vCTS: LSS_dbHighCpuUtilization", - "LSS_dbOffline": "vCTS: LSS_dbOffline", - "LSS_dbStatusUnexpected": "vCTS: LSS_dbStatusUnexpected", - "LSS_degradedResource": "vCTS: LSS_degradedResource", - "LSS_degrow": "vCTS: LSS_degrow", - "LSS_deviceServerCxnLost": "vCTS: LSS_deviceServerCxnLost", - "LSS_diamLinkDown": "vCTS: LSS_diamLinkDown", - "LSS_diamMaxClientsExceeded": "vCTS: LSS_diamMaxClientsExceeded", - "LSS_dnsThreshold": "vCTS: LSS_dnsThreshold", - "LSS_ethernetError": "vCTS: LSS_ethernetError", - "LSS_ethernetLinkDown": "vCTS: LSS_ethernetLinkDown", - "LSS_externalConnectivity": "vCTS: LSS_externalConnectivity", - "LSS_featureLicenseExpiration": "vCTS: LSS_featureLicenseExpiration", - "LSS_featureLicenseKeyNearExpiration": "vCTS: LSS_featureLicenseKeyNearExpiration", - "LSS_featureLockValidationError": "vCTS: LSS_featureLockValidationError", - "LSS_fqdnError": "vCTS: LSS_fqdnError", - "LSS_fru": "vCTS: LSS_fru", - "LSS_gatewayCongestion": "vCTS: LSS_gatewayCongestion", - "LSS_gatewayForcedOOS": "vCTS: LSS_gatewayForcedOOS", - "LSS_gatewayProvisioningError": "vCTS: LSS_gatewayProvisioningError", - "LSS_gatewayUnreachable": "vCTS: LSS_gatewayUnreachable", - "LSS_gatewayUnregistered": "vCTS: LSS_gatewayUnregistered", - "LSS_globalParameterNotFound": "vCTS: LSS_globalParameterNotFound", - "LSS_grow": "vCTS: LSS_grow", - "LSS_h248MessageBufferDepletion": "vCTS: LSS_h248MessageBufferDepletion", - "LSS_hostDown": "vCTS: LSS_hostDown", - "LSS_hostReset": "vCTS: LSS_hostReset", - "LSS_invalidGateway": "vCTS: LSS_invalidGateway", - "LSS_iriLinkDown": "vCTS: LSS_iriLinkDown", - "LSS_ldapServerConnectionLost": "vCTS: LSS_ldapServerConnectionLost", - "LSS_llcDown": "vCTS: LSS_llcDown", - "LSS_logicalLinkDown": "vCTS: LSS_logicalLinkDown", - "LSS_logicalLinkNotFound": "vCTS: LSS_logicalLinkNotFound", - "LSS_logRotateThreshold": "vCTS: LSS_logRotateThreshold", - "LSS_memoryOverload": "vCTS: LSS_memoryOverload", - "LSS_nodeConfigFailure": "vCTS: LSS_nodeConfigFailure", - "LSS_nodeGroupOOS": "vCTS: LSS_nodeGroupOOS", - "LSS_nodeOOS": "vCTS: LSS_nodeOOS", - "LSS_nonCompliantFaultGroupMemberState": "vCTS: LSS_nonCompliantFaultGroupMemberState", - "LSS_nonCsAddrChannelDepletion": "vCTS: LSS_nonCsAddrChannelDepletion", - "LSS_numberOfTuplesInUse": "vCTS: LSS_numberOfTuplesInUse", - "LSS_osSecInfoModificationDetected": "vCTS: LSS_osSecInfoModificationDetected", - "LSS_osSecInformationMissing": "vCTS: LSS_osSecInformationMissing", - "LSS_osSecUnexpectedInformation": "vCTS: LSS_osSecUnexpectedInformation", - "LSS_pdnsMySqlReplication": "vCTS: LSS_pdnsMySqlReplication", - "LSS_pktCorruptionDetectedViaRCCLANCheck": "vCTS: LSS_pktCorruptionDetectedViaRCCLANCheck", - "LSS_platformCommandFailure": "vCTS: LSS_platformCommandFailure", - "LSS_pmDataNotCollected": "vCTS: LSS_pmDataNotCollected", - "LSS_processDown": "vCTS: LSS_processDown", - "LSS_processNotStarted": "vCTS: LSS_processNotStarted", - "LSS_provisioningInhibitedMode": "vCTS: LSS_provisioningInhibitedMode", - "LSS_rccInhibitedMode": "vCTS: LSS_rccInhibitedMode", - "LSS_remotedbLinkDown": "vCTS: LSS_remotedbLinkDown", - "LSS_remoteQueryServerFailure": "vCTS: LSS_remoteQueryServerFailure", - "LSS_restore": "vCTS: LSS_restore", - "LSS_serviceCFGDataTimestampError": "vCTS: LSS_serviceCFGDataTimestampError", - "LSS_serviceCommCxnLost": "vCTS: LSS_serviceCommCxnLost", - "LSS_serviceOnewayCommunication": "vCTS: LSS_serviceOnewayCommunication", - "LSS_sheddingOverload": "vCTS: LSS_sheddingOverload", - "LSS_simxml": "vCTS: LSS_simxml", - "LSS_sipLinkSetMaxQuarantineList": "vCTS: LSS_sipLinkSetMaxQuarantineList", - "LSS_sipLinkSetUnavailable": "vCTS: LSS_sipLinkSetUnavailable", - "LSS_sipLinkUnavailable": "vCTS: LSS_sipLinkUnavailable", - "LSS_softwareAllocatedResourceOverload": "vCTS: LSS_softwareAllocatedResourceOverload", - "LSS_softwareComponentStandbyNotReady": "vCTS: LSS_softwareComponentStandbyNotReady", - "LSS_softwareLicense": "vCTS: LSS_softwareLicense", - "LSS_svcdegrow": "vCTS: LSS_svcdegrow", - "LSS_svcgrow": "vCTS: LSS_svcgrow", - "LSS_swVersionMismatch": "vCTS: LSS_swVersionMismatch", - "LSS_tftpDownloadCorrupt": "vCTS: LSS_tftpDownloadCorrupt", - "LSS_timeStampValueOutOfSystemRange": "vCTS: LSS_timeStampValueOutOfSystemRange", - "LSS_transactionHandlerBlockDepletion": "vCTS: LSS_transactionHandlerBlockDepletion", - "LSS_upgrade": "vCTS: LSS_upgrade", - "SYS_BackupFailure": "vCTS: SYS_BackupFailure", - "SYS_Configuration": "vCTS: SYS_Configuration", - "SYS_COTRecordTransferFailure": "vCTS: SYS_COTRecordTransferFailure", - "SYS_CPM_USERDATA_INCONSITENCY": "vCTS: SYS_CPM_USERDATA_INCONSITENCY", - "SYS_CPM_USERDATA_RESTORED": "vCTS: SYS_CPM_USERDATA_RESTORED", - "SYS_EventQueueCapacity": "vCTS: SYS_EventQueueCapacity", - "SYS_ICMPFailure": "vCTS: SYS_ICMPFailure", - "SYS_IPsecConfig": "vCTS: SYS_IPsecConfig", - "SYS_LinkDown": "vCTS: SYS_LinkDown", - "SYS_NotifyDisabled": "vCTS: SYS_NotifyDisabled", - "SYS_NotifyLocked": "vCTS: SYS_NotifyLocked", - "SYS_NumTL1MeasThresh": "vCTS: SYS_NumTL1MeasThresh", - "SYS_RADIUS_TO_LDAP_FAILURE": "vCTS: SYS_RADIUS_TO_LDAP_FAILURE", - "SYS_ROOT_ACCESS_DENIED": "vCTS: SYS_ROOT_ACCESS_DENIED", - "SYS_ROOT_FTP_VIOLATION": "vCTS: SYS_ROOT_FTP_VIOLATION", - "SYS_ROOT_LOGIN_VIOLATION": "vCTS: SYS_ROOT_LOGIN_VIOLATION", - "SYS_ROOT_SSH_LOGIN_VIOLATION": "vCTS: SYS_ROOT_SSH_LOGIN_VIOLATION", - "SYS_SetupAAAFailure": "vCTS: SYS_SetupAAAFailure", - "SYS_SNETrapOverload": "vCTS: SYS_SNETrapOverload", - "SYS_SNMPAuthenticationFailure": "vCTS: SYS_SNMPAuthenticationFailure", - "SYS_SNMPFailure": "vCTS: SYS_SNMPFailure", - "SYS_SU_TO_ROOT_FAILURE": "vCTS: SYS_SU_TO_ROOT_FAILURE", - "SYS_SYSTEMTrapOverload": "vCTS: SYS_SYSTEMTrapOverload", - "SYS_ThresholdCrossed": "vCTS: SYS_ThresholdCrossed", - "SYS_UndiscoveredObject": "vCTS: SYS_UndiscoveredObject", - "SYS_WriteAAAFailure": "vCTS: SYS_WriteAAAFailure", - "jnxSpaceDiskUsageRising": "vDBE-EMS-Juniper: jnxSpaceDiskUsageRising", - "jnxSpaceDiskUsageRisingCleared": "vDBE-EMS-Juniper: jnxSpaceDiskUsageRisingCleared", - "jnxSpaceSwapUsageRising": "vDBE-EMS-Juniper: jnxSpaceSwapUsageRising", - "jnxSpaceSwapUsageRisingCleared": "vDBE-EMS-Juniper: jnxSpaceSwapUsageRisingCleared", - "jnxSpaceCPULARising": "vDBE-EMS-Juniper: jnxSpaceCPULARising", - "jnxSpaceCPULARisingCleared": "vDBE-EMS-Juniper: jnxSpaceCPULARisingCleared", - "jnxSpaceWebpProxyProcessDown": "vDBE-EMS-Juniper: jnxSpaceWebpProxyProcessDown", - "jnxSpaceWebpProxyProcessUp": "vDBE-EMS-Juniper: jnxSpaceWebpProxyProcessUp", - "jnxSpaceNMAProcessDown": "vDBE-EMS-Juniper: jnxSpaceNMAProcessDown", - "jnxSpaceNMAProcessUp": "vDBE-EMS-Juniper: jnxSpaceNMAProcessUp", - "jnxSpaceJbossProcessDown": "vDBE-EMS-Juniper: jnxSpaceJbossProcessDown", - "jnxSpaceJbossProcessUp": "vDBE-EMS-Juniper: jnxSpaceJbossProcessUp", - "jnxSpaceMysqlProcessDown": "vDBE-EMS-Juniper: jnxSpaceMysqlProcessDown", - "jnxSpaceMysqlProcessUp": "vDBE-EMS-Juniper: jnxSpaceMysqlProcessUp", - "jnxSpacePostgresqlProcessDown": "vDBE-EMS-Juniper: jnxSpacePostgresqlProcessDown", - "jnxSpacePostgresqlProcessUp": "vDBE-EMS-Juniper: jnxSpacePostgresqlProcessUp", - "jnxSpaceWatchdogStopped": "vDBE-EMS-Juniper: jnxSpaceWatchdogStopped", - "jnxSpaceWatchdogStarted": "vDBE-EMS-Juniper: jnxSpaceWatchdogStarted", - "jnxSpaceSNAProcessDown": "vDBE-EMS-Juniper: jnxSpaceSNAProcessDown", - "jnxSpaceSNAProcessUp": "vDBE-EMS-Juniper: jnxSpaceSNAProcessUp", - "jnxSpaceNodeDown": "vDBE-EMS-Juniper: jnxSpaceNodeDown", - "jnxSpaceNodeUp": "vDBE-EMS-Juniper: jnxSpaceNodeUp", - "jnxSpaceNodeRemoval": "vDBE-EMS-Juniper: jnxSpaceNodeRemoval", - "jnxCmCfgChange": "vDBE-Juniper: jnxCmCfgChange", - "jnxCmRescueChange": "vDBE-Juniper: jnxCmRescueChange", - "jnxEventTrap": "vDBE-Juniper: jnxEventTrap", - "jnxJsFwAuthFailure": "vDBE-Juniper: jnxJsFwAuthFailure", - "jnxJsFwAuthServiceUp": "vDBE-Juniper: jnxJsFwAuthServiceUp", - "jnxJsFwAuthServiceDown": "vDBE-Juniper: jnxJsFwAuthServiceDown", - "jnxJsFwAuthCapacityExceeded": "vDBE-Juniper: jnxJsFwAuthCapacityExceeded", - "jnxJsIdpSignatureUpdate": "vDBE-Juniper: jnxJsIdpSignatureUpdate", - "jnxJsIdpAttackLog": "vDBE-Juniper: jnxJsIdpAttackLog", - "jnxJsSrcNatPoolThresholdStatus": "vDBE-Juniper: jnxJsSrcNatPoolThresholdStatus", - "jnxJsNatRuleThresholdStatus": "vDBE-Juniper: jnxJsNatRuleThresholdStatus", - "jnxJsScreenAttack": "vDBE-Juniper: jnxJsScreenAttack", - "jnxJsScreenCfgChange": "vDBE-Juniper: jnxJsScreenCfgChange", - "jnxJsAvPatternUpdateTrap": "vDBE-Juniper: jnxJsAvPatternUpdateTrap", - "jnxJsChassisClusterSwitchover": "vDBE-Juniper: jnxJsChassisClusterSwitchover", - "jnxJsChClusterIntfTrap": "vDBE-Juniper: jnxJsChClusterIntfTrap", - "jnxJsChClusterSpuMismatchTrap": "vDBE-Juniper: jnxJsChClusterSpuMismatchTrap", - "jnxJsChClusterWeightTrap": "vDBE-Juniper: jnxJsChClusterWeightTrap", - "jnxLicenseGraceExpired": "vDBE-Juniper: jnxLicenseGraceExpired", - "jnxLicenseGraceAboutToExpire": "vDBE-Juniper: jnxLicenseGraceAboutToExpire", - "jnxLicenseAboutToExpire": "vDBE-Juniper: jnxLicenseAboutToExpire", - "jnxLicenseInfringeCumulative": "vDBE-Juniper: jnxLicenseInfringeCumulative", - "jnxLicenseInfringeSingle": "vDBE-Juniper: jnxLicenseInfringeSingle", - "jnxNatAddrPoolThresholdStatus": "vDBE-Juniper: jnxNatAddrPoolThresholdStatus", - "jnxSyslogTrap": "vDBE-Juniper: jnxSyslogTrap", - "jnxAccessAuthServiceUp": "vDBE-Juniper: jnxAccessAuthServiceUp", - "jnxAccessAuthServiceDown": "vDBE-Juniper: jnxAccessAuthServiceDown", - "jnxAccessAuthServerDisabled": "vDBE-Juniper: jnxAccessAuthServerDisabled", - "jnxAccessAuthServerEnabled": "vDBE-Juniper: jnxAccessAuthServerEnabled", - "jnxAccessAuthAddressPoolHighThreshold": "vDBE-Juniper: jnxAccessAuthAddressPoolHighThreshold", - "jnxAccessAuthAddressPoolAbateThreshold": "vDBE-Juniper: jnxAccessAuthAddressPoolAbateThreshold", - "jnxAccessAuthAddressPoolOutOfAddresses": "vDBE-Juniper: jnxAccessAuthAddressPoolOutOfAddresses", - "jnxAccessAuthAddressPoolOutOfMemory": "vDBE-Juniper: jnxAccessAuthAddressPoolOutOfMemory", - "LEVEL_WARNING_CPU": "vMRF: LEVEL_WARNING_CPU", - "LEVEL_MAJOR_CPU": "vMRF: LEVEL_MAJOR_CPU", - "LEVEL_CRITICAL_CPU": "vMRF: LEVEL_CRITICAL_CPU", - "LEVEL_WARNING_MEM": "vMRF: LEVEL_WARNING_MEM", - "LEVEL_MAJOR_MEM": "vMRF: LEVEL_MAJOR_MEM", - "LEVEL_CRITICAL_MEM": "vMRF: LEVEL_CRITICAL_MEM", - "LEVEL_WARNING_DISK": "vMRF: LEVEL_WARNING_DISK", - "LEVEL_MAJOR_DISK": "vMRF: LEVEL_MAJOR_DISK", - "LEVEL_CRITICAL_DISK": "vMRF: LEVEL_CRITICAL_DISK", - "LEVEL_WARNING_RTPBANDWIDTH": "vMRF: LEVEL_WARNING_RTPBANDWIDTH", - "LEVEL_MAJOR_RTPBANDWIDTH": "vMRF: LEVEL_MAJOR_RTPBANDWIDTH", - "LEVEL_CRITICAL_RTPBANDWIDTH": "vMRF: LEVEL_CRITICAL_RTPBANDWIDTH", - "LEVEL_WARNING_RTPINPACKETLOSS": "vMRF: LEVEL_WARNING_RTPINPACKETLOSS", - "LEVEL_MAJOR_RTPINPACKETLOSS": "vMRF: LEVEL_MAJOR_RTPINPACKETLOSS", - "LEVEL_CRITICAL_RTPINPACKETLOSS": "vMRF: LEVEL_CRITICAL_RTPINPACKETLOSS", - "LEVEL_WARNING_RTPOUTPACKETLOSS": "vMRF: LEVEL_WARNING_RTPOUTPACKETLOSS", - "LEVEL_MAJOR_RTPOUTPACKETLOSS": "vMRF: LEVEL_MAJOR_RTPOUTPACKETLOSS", - "LEVEL_CRITICAL_RTPOUTPACKETLOSS": "vMRF: LEVEL_CRITICAL_RTPOUTPACKETLOSS", - "LEVEL_WARNING_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_WARNING_TCPLOSTRETRANSMITRATE", - "LEVEL_MAJOR_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_MAJOR_TCPLOSTRETRANSMITRATE", - "LEVEL_CRITICAL_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_CRITICAL_TCPLOSTRETRANSMITRATE", - "LEVEL_WARNING_TCPLOSSFAILURERATE": "vMRF: LEVEL_WARNING_TCPLOSSFAILURERATE", - "LEVEL_MAJOR_TCPLOSSFAILURERATE": "vMRF: LEVEL_MAJOR_TCPLOSSFAILURERATE", - "LEVEL_CRITICAL_TCPLOSSFAILURERATE": "vMRF: LEVEL_CRITICAL_TCPLOSSFAILURERATE", - "LEVEL_CRITICAL_RTPLINKDOWN": "vMRF: LEVEL_CRITICAL_RTPLINKDOWN", - "TARGET_REACHABLE": "vMRF: TARGET_REACHABLE", - "PUBLICATION_ERROR": "vMRF: PUBLICATION_ERROR", - "REMOTE_SERVER_SYNCHRONIZATION_ERROR": "vMRF: REMOTE_SERVER_SYNCHRONIZATION_ERROR", - "TRANSCODER_TOOL_EXEC_ERROR": "vMRF: TRANSCODER_TOOL_EXEC_ERROR", - "CLIENT_SYNCHRONIZATION_ERROR": "vMRF: CLIENT_SYNCHRONIZATION_ERROR", - "CLUSTER_UNREACHABLE": "vMRF: CLUSTER_UNREACHABLE", - "REMOTE_NODE_OFFLINE": "vMRF: REMOTE_NODE_OFFLINE", - "IPADDR_STOPPED": "vMRF: IPADDR_STOPPED", - "MRFC_STOPPED": "vMRF: MRFC_STOPPED", - "MNGT_STOPPED": "vMRF: MNGT_STOPPED", - "IPADDR_STARTED": "vMRF: IPADDR_STARTED", - "MRFC_STARTED": "vMRF: MRFC_STARTED", - "MNGT_STARTED": "vMRF: MNGT_STARTED", - "VOLATTACH_FAILED": "vMRF: VOLATTACH_FAILED", - "VOLDETACH_FAILED": "vMRF: VOLDETACH_FAILED", - "VOLDEL": "vMRF: VOLDEL", - "VOLCORRUPT": "vMRF: VOLCORRUPT", - "VOLFOREIGN": "vMRF: VOLFOREIGN", - "ACTIVE_ALARM_TABLE_PURGE": "vMRF: ACTIVE_ALARM_TABLE_PURGE", - "GENERIC_FORMER_STATELESS": "vMRF: GENERIC_FORMER_STATELESS", - "GENERIC_FORMER_STATEFUL": "vMRF: GENERIC_FORMER_STATEFUL", - "NO_MORE_ALARM_DESCRIPTION": "vMRF: NO_MORE_ALARM_DESCRIPTION", - "SERVICE_PROCESS_ENDS": "vMRF: SERVICE_PROCESS_ENDS", - "DEFENSE_STOPPED": "vMRF: DEFENSE_STOPPED", - "USER_ACCOUNT_LOCKED": "vMRF: USER_ACCOUNT_LOCKED", - "CONNECTION_SQL_NOT_ESTABLISHED": "vMRF: CONNECTION_SQL_NOT_ESTABLISHED", - "FALSE_ALARM": "vMRF: FALSE_ALARM", - "RADIUS SERVER HS": "vMRF: RADIUS SERVER HS", - "DRM_PACKAGER_IS_NOT_AVAILABLE": "vMRF: DRM_PACKAGER_IS_NOT_AVAILABLE", - "DRM_LICENSE_BUILDER_IS_NOT_AVAILABLE": "vMRF: DRM_LICENSE_BUILDER_IS_NOT_AVAILABLE", - "ERROR_WHILE_CREATING_PLAYLIST_MANAGER_FILE": "vMRF: ERROR_WHILE_CREATING_PLAYLIST_MANAGER_FILE", - "ERROR_WHILE_BUILDING_PLAYLIST_XML_REPRESENTATION": "vMRF: ERROR_WHILE_BUILDING_PLAYLIST_XML_REPRESENTATION", - "PLAYLIST_FILE_TO_PUBLISH_NOT_FOUND": "vMRF: PLAYLIST_FILE_TO_PUBLISH_NOT_FOUND", - "COULD_NOT_CONNECT_TO_PVNS_SERVER": "vMRF: COULD_NOT_CONNECT_TO_PVNS_SERVER", - "HTTP_OR_HTTPCLIENT_EXCEPTION_HAS_OCCURRED": "vMRF: HTTP_OR_HTTPCLIENT_EXCEPTION_HAS_OCCURRED", - "I/O_ERROR_WHILE_PUBLISHING_PLAYLIST_FILE": "vMRF: I/O_ERROR_WHILE_PUBLISHING_PLAYLIST_FILE", - "ERROR_WHILE_REQUESTING_SDP_FILE": "vMRF: ERROR_WHILE_REQUESTING_SDP_FILE", - "ERROR_WHILE_REQUESTING_SDP_FILE:_REMOTE_EXCEPTION": "vMRF: ERROR_WHILE_REQUESTING_SDP_FILE:_REMOTE_EXCEPTION", - "NO_STREAMING_RESOURCES": "vMRF: NO_STREAMING_RESOURCES", - "NO_STREAMING_MODULES_REGISTERED": "vMRF: NO_STREAMING_MODULES_REGISTERED", - "SM_FAILURE": "vMRF: SM_FAILURE", - "MISSING_FILE_OR_ENCODER": "vMRF: MISSING_FILE_OR_ENCODER", - "INVALID_RANGE": "vMRF: INVALID_RANGE", - "THRESHOLD_VALUE_EXCEEDED": "vMRF: THRESHOLD_VALUE_EXCEEDED", - "TICKET_QUEUE_FULL": "vMRF: TICKET_QUEUE_FULL", - "PARSING_INITIALIZATION_EXCEPTION": "vMRF: PARSING_INITIALIZATION_EXCEPTION", - "CUSTOMERCARE_INTERNAL_EXCEPTION": "vMRF: CUSTOMERCARE_INTERNAL_EXCEPTION", - "PARSING_EXCEPTION": "vMRF: PARSING_EXCEPTION", - "I/O_PROBLEM": "vMRF: I/O_PROBLEM", - "INEXISTENT_FILE_OR_FOLDER": "vMRF: INEXISTENT_FILE_OR_FOLDER", - "FILE_NOT_IN_XML_FORMAT": "vMRF: FILE_NOT_IN_XML_FORMAT", - "SERVICE_STATE_CHANGE": "vMRF: SERVICE_STATE_CHANGE", - "MONITORED_FILE_UPDATE_ERROR": "vMRF: MONITORED_FILE_UPDATE_ERROR", - "MONITORED_RPM_DELETED_ERROR": "vMRF: MONITORED_RPM_DELETED_ERROR", - "MONITORED_RPM_ADDED_ERROR": "vMRF: MONITORED_RPM_ADDED_ERROR", - "MONITORED_CHMOD_ERROR": "vMRF: MONITORED_CHMOD_ERROR", - "MONITORED_CHOWN_ERROR": "vMRF: MONITORED_CHOWN_ERROR", - "PASSWD_ROOT_ERROR": "vMRF: PASSWD_ROOT_ERROR", - "PASSWD_ERROR": "vMRF: PASSWD_ERROR", - "ROOTKIT_ERROR": "vMRF: ROOTKIT_ERROR", - "STARTUP_ERR_UNDEFINED_PORT": "vMRF: STARTUP_ERR_UNDEFINED_PORT", - "STARTUP_ERR_FAIL_FIND_HOSTNAME": "vMRF: STARTUP_ERR_FAIL_FIND_HOSTNAME", - "STARTUP_ERR_CF_MISSING": "vMRF: STARTUP_ERR_CF_MISSING", - "STARTUP_ERR_FAILED_TO_OPEN_CF": "vMRF: STARTUP_ERR_FAILED_TO_OPEN_CF", - "STARTUP_ERR_FAILED_TO_BIND_PORT": "vMRF: STARTUP_ERR_FAILED_TO_BIND_PORT", - "STARTUP_ERR_CFG_UNIT_MISSING": "vMRF: STARTUP_ERR_CFG_UNIT_MISSING", - "MCTR_INVALID_CODEC_NAME": "vMRF: MCTR_INVALID_CODEC_NAME", - "RTSP_SERVER_FAILURE": "vMRF: RTSP_SERVER_FAILURE", - "RTSP_SERVER_QUARANTINE": "vMRF: RTSP_SERVER_QUARANTINE", - "TRANSCODING_FAILURE": "vMRF: TRANSCODING_FAILURE", - "FILE_CACHE_FAILURE": "vMRF: FILE_CACHE_FAILURE", - "STARTUP_ERROR_INITIALIZATION_FAILED": "vMRF: STARTUP_ERROR_INITIALIZATION_FAILED", - "CONFERENCE_FAILURE": "vMRF: CONFERENCE_FAILURE", - "PLC_DEGRADATION_LOW": "vMRF: PLC_DEGRADATION_LOW", - "PLC_DEGRADATION_MEDIUM": "vMRF: PLC_DEGRADATION_MEDIUM", - "PLC_DEGRADATION_HIGH": "vMRF: PLC_DEGRADATION_HIGH", - "AUDIO_RESYNCH_LOW": "vMRF: AUDIO_RESYNCH_LOW", - "AUDIO_RESYNCH_MEDIUM": "vMRF: AUDIO_RESYNCH_MEDIUM", - "AUDIO_RESYNCH_HIGH": "vMRF: AUDIO_RESYNCH_HIGH", - "VIDEO_RESYNCH_LOW": "vMRF: VIDEO_RESYNCH_LOW", - "VIDEO_RESYNCH_MEDIUM": "vMRF: VIDEO_RESYNCH_MEDIUM", - "VIDEO_RESYNCH_HIGH": "vMRF: VIDEO_RESYNCH_HIGH", - "PLAY_FAILURES_LOW": "vMRF: PLAY_FAILURES_LOW", - "PLAY_FAILURES_MEDIUM": "vMRF: PLAY_FAILURES_MEDIUM", - "PLAY_FAILURES_HIGH": "vMRF: PLAY_FAILURES_HIGH", - "NOT_ENOUGH_FREE_CONFEREE": "vMRF: NOT_ENOUGH_FREE_CONFEREE", - "NO_LONGER_FREE_CONFERENCE_ROOM": "vMRF: NO_LONGER_FREE_CONFERENCE_ROOM", - "STARTUP_ERROR_FAIL_TO_READ_CF": "vMRF: STARTUP_ERROR_FAIL_TO_READ_CF", - "STARTUP_ERROR_SIP_ADAPTER_INIT": "vMRF: STARTUP_ERROR_SIP_ADAPTER_INIT", - "STARTUP_ERROR_MONITORING_INIT": "vMRF: STARTUP_ERROR_MONITORING_INIT", - "REGISTER_ERROR_FAILURE": "vMRF: REGISTER_ERROR_FAILURE", - "DRI_ERROR_FAILURE": "vMRF: DRI_ERROR_FAILURE", - "STARTUP_ERROR_STACK_CONFIGURATION": "vMRF: STARTUP_ERROR_STACK_CONFIGURATION", - "STARTUP_ERROR_CONF": "vMRF: STARTUP_ERROR_CONF", - "STARTUP_ERROR_UNDEFINED_PORT": "vMRF: STARTUP_ERROR_UNDEFINED_PORT", - "HOST_REMOVED": "vMRF: HOST_REMOVED", - "INTERCEPT_THRESHOLD_NB_DIALOG_ALLOCATED": "vMRF: INTERCEPT_THRESHOLD_NB_DIALOG_ALLOCATED", - "STARTUP_ERROR_STACK_CONF": "vMRF: STARTUP_ERROR_STACK_CONF", - "STARTUP_ERROR_CONFIGURATION": "vMRF: STARTUP_ERROR_CONFIGURATION", - "STARTUP_ERROR_FAILED_TO_RETRIEVE_HOSTNAME": "vMRF: STARTUP_ERROR_FAILED_TO_RETRIEVE_HOSTNAME", - "LEVEL_WARNING_CALL": "vMRF: LEVEL_WARNING_CALL", - "LEVEL_ALARM_MINOR_CALL": "vMRF: LEVEL_ALARM_MINOR_CALL", - "LEVEL_ALARM_MAJOR_CALL": "vMRF: LEVEL_ALARM_MAJOR_CALL", - "LEVEL_ALARM_MRFPoutOfService": "vMRF: LEVEL_ALARM_MRFPoutOfService", - "MRFP_CALL_REJECTED_Threshold #1": "vMRF: MRFP_CALL_REJECTED_Threshold #1", - "MRFP_CALL_REJECTED_Threshold #2": "vMRF: MRFP_CALL_REJECTED_Threshold #2", - "MRFP_CALL_REJECTED_Threshold #3": "vMRF: MRFP_CALL_REJECTED_Threshold #3", - "MRFP_CALL_RETRIED_Threshold #1": "vMRF: MRFP_CALL_RETRIED_Threshold #1", - "MRFP_CALL_RETRIED_Threshold #2": "vMRF: MRFP_CALL_RETRIED_Threshold #2", - "MRFP_CALL_RETRIED_Threshold #3": "vMRF: MRFP_CALL_RETRIED_Threshold #3", - "STARTUP_PUB_FILE_NOT_PRESENT": "vMRF: STARTUP_PUB_FILE_NOT_PRESENT", - "STARTUP_INF_FILE_NOT_PRESENT": "vMRF: STARTUP_INF_FILE_NOT_PRESENT", - "STARTUP_LIC_FILE_NOT_PRESENT": "vMRF: STARTUP_LIC_FILE_NOT_PRESENT", - "GENERIC_HARDWARE_PROBLEM": "vMRF: GENERIC_HARDWARE_PROBLEM", - "HARD_DRIVE_PROBLEM": "vMRF: HARD_DRIVE_PROBLEM", - "NETWORK_LINK_PROBLEM": "vMRF: NETWORK_LINK_PROBLEM", - "POWER_SUPPLY_PROBLEM": "vMRF: POWER_SUPPLY_PROBLEM", - "SMART_HARD_DRIVE_PROBLEM": "vMRF: SMART_HARD_DRIVE_PROBLEM", - "STARTUP_ERROR": "vMRF: STARTUP_ERROR", - "RESOURCE_NOT_ACCESSIBLE": "vMRF: RESOURCE_NOT_ACCESSIBLE", - "RESOURCE_ACCESSIBLE": "vMRF: RESOURCE_ACCESSIBLE", - "RESOURCE_FULL": "vMRF: RESOURCE_FULL", - "DRI_ALARM": "vMRF: DRI_ALARM", - "REGISTER_ERROR_CCF": "vMRF: REGISTER_ERROR_CCF", - "REGISTER_ERROR_EXTERNAL": "vMRF: REGISTER_ERROR_EXTERNAL", - "TIMEOUT_ERROR": "vMRF: TIMEOUT_ERROR", - "VXML_ERROR": "vMRF: VXML_ERROR", - "A Network Element is no longer available due to a connection failure": "vMVM: A Network Element is no longer available due to a connection failure", - "A MetaSphere server is reporting a fault with the configuration of its connection to MetaView": "vMVM: A MetaSphere server is reporting a fault with the configuration of its connection to MetaView", - "Configured OBS IPs don't match available OBS nodes. Configured but unavailable nodes include: [<IP address>]. Real nodes not configured include: []": "vMVM: Configured OBS IPs don't match available OBS nodes. Configured but unavailable nodes include: [<IP address>]. Real nodes not configured include: []", - "Service Assurance Server <IP address> cannot be contacted": "vMVM: Service Assurance Server <IP address> cannot be contacted", - "The primary MetaView Director has lost contact with the backup MetaView Director": "vMVM: The primary MetaView Director has lost contact with the backup MetaView Director", - "The active server has lost connection to the standby": "vMVM: The active server has lost connection to the standby", - "CrashCounter": "vprobes-vBE-Processing: CrashCounter", - "IsAlive": "vprobes-vBE-Processing: IsAlive", - "SwRestart": "vprobes-vLB: SwRestart", - "Repeated exceptions have occurred.": "vSBC-Metaswitch: Repeated exceptions have occurred.", - "A licensing limit is close to capacity.": "vSBC-Metaswitch: A licensing limit is close to capacity.", - "One or more feature packs have been breached.": "vSBC-Metaswitch: One or more feature packs have been breached.", - "The grace period on this Perimeta system will expire in less than 48 hours, after which calls will not be processed.": "vSBC-Metaswitch: The grace period on this Perimeta system will expire in less than 48 hours, after which calls will not be processed.", - "The grace period on this Perimeta system will expire in less than 7 days, after which calls will not be processed.": "vSBC-Metaswitch: The grace period on this Perimeta system will expire in less than 7 days, after which calls will not be processed.", - "The license on this Perimeta system will expire in less than 4 weeks.": "vSBC-Metaswitch: The license on this Perimeta system will expire in less than 4 weeks.", - "A Perimeta blade has become unlicensed.": "vSBC-Metaswitch: A Perimeta blade has become unlicensed.", - "Perimeta is licensed with a bypass certificate, which is valid until the time displayed.": "vSBC-Metaswitch: Perimeta is licensed with a bypass certificate, which is valid until the time displayed.", - "The number of licensed instances exceeded a threshold of the licensed limit.": "vSBC-Metaswitch: The number of licensed instances exceeded a threshold of the licensed limit.", - "The software token on the primary Distributed Capacity Manager will expire on the displayed date.": "vSBC-Metaswitch: The software token on the primary Distributed Capacity Manager will expire on the displayed date.", - "A capacity limit on the license installed on this Perimeta system does not match the largest limit across all systems in the deployment.": "vSBC-Metaswitch: A capacity limit on the license installed on this Perimeta system does not match the largest limit across all systems in the deployment.", - "An adjacency has voice quality alerts.": "vSBC-Metaswitch: An adjacency has voice quality alerts.", - "The number of calls being audited is congested.": "vSBC-Metaswitch: The number of calls being audited is congested.", - "Session Controller is rejecting calls because there is no valid active call policy set configured.": "vSBC-Metaswitch: Session Controller is rejecting calls because there is no valid active call policy set configured.", - "A call policy set is inactive because it has been misconfigured.": "vSBC-Metaswitch: A call policy set is inactive because it has been misconfigured.", - "Session Controller is inactive and rejecting calls.": "vSBC-Metaswitch: Session Controller is inactive and rejecting calls.", - "Sources have breached minor or major blacklist thresholds.": "vSBC-Metaswitch: Sources have breached minor or major blacklist thresholds.", - "Sources are blacklisted.": "vSBC-Metaswitch: Sources are blacklisted.", - "The blacklisting configuration will change as a result of upgrade and some configured blacklists or alerts will no longer be applied.": "vSBC-Metaswitch: The blacklisting configuration will change as a result of upgrade and some configured blacklists or alerts will no longer be applied.", - "A large number of downgrades and bans have been created as a result of blacklisting.": "vSBC-Metaswitch: A large number of downgrades and bans have been created as a result of blacklisting.", - "Session Controller is unable to track further sources for blacklisting.": "vSBC-Metaswitch: Session Controller is unable to track further sources for blacklisting.", - "A software protection switch was triggered.": "vSBC-Metaswitch: A software protection switch was triggered.", - "A disk area on a processor blade is nearly full.": "vSBC-Metaswitch: A disk area on a processor blade is nearly full.", - "Memory use is very high.": "vSBC-Metaswitch: Memory use is very high.", - "The primary processor-blade has lost contact with the backup.": "vSBC-Metaswitch: The primary processor-blade has lost contact with the backup.", - "An efix or patch has been applied to this system containing diagnostic versions of some software libraries.": "vSBC-Metaswitch: An efix or patch has been applied to this system containing diagnostic versions of some software libraries.", - "A software protection switch (SPS) was triggered. Call and registration state was lost.": "vSBC-Metaswitch: A software protection switch (SPS) was triggered. Call and registration state was lost.", - "The Ethernet Heartbeat between primary and backup processors has failed.": "vSBC-Metaswitch: The Ethernet Heartbeat between primary and backup processors has failed.", - "The Backplane Heartbeat between primary and backup processors has failed.": "vSBC-Metaswitch: The Backplane Heartbeat between primary and backup processors has failed.", - "A disk area on a processor blade reported an error.": "vSBC-Metaswitch: A disk area on a processor blade reported an error.", - "The system is upgrading.": "vSBC-Metaswitch: The system is upgrading.", - "An error with NTP functionality has been detected.": "vSBC-Metaswitch: An error with NTP functionality has been detected.", - "One or more users are locked out of the system.": "vSBC-Metaswitch: One or more users are locked out of the system.", - "The Craft Terminal user FTP directory on a processor blade is nearly full.": "vSBC-Metaswitch: The Craft Terminal user FTP directory on a processor blade is nearly full.", - "A scheduled configuration snapshot has failed.": "vSBC-Metaswitch: A scheduled configuration snapshot has failed.", - "The Session Controller is stopping as a result of administrator action.": "vSBC-Metaswitch: The Session Controller is stopping as a result of administrator action.", - "A Session Controller processor blade is stopping as a result of administrator action.": "vSBC-Metaswitch: A Session Controller processor blade is stopping as a result of administrator action.", - "An object could not be activated because its service address does not exist or is not fully specified.": "vSBC-Metaswitch: An object could not be activated because its service address does not exist or is not fully specified.", - "The hardware on a processor does not meet minimum requirements.": "vSBC-Metaswitch: The hardware on a processor does not meet minimum requirements.", - "The hardware expectations of the two processors are not the same.": "vSBC-Metaswitch: The hardware expectations of the two processors are not the same.", - "The read speed of the main hard disk on a processor blade is too slow.": "vSBC-Metaswitch: The read speed of the main hard disk on a processor blade is too slow.", - "An error has occurred reading from the hard disk on a processor blade.": "vSBC-Metaswitch: An error has occurred reading from the hard disk on a processor blade.", - "Backup and primary processor-blades have an inconsistent system role.": "vSBC-Metaswitch: Backup and primary processor-blades have an inconsistent system role.", - "Event: The system encountered a critical error and had to restart.": "vSBC-Metaswitch: Event: The system encountered a critical error and had to restart.", - "Event: A RADIUS server failed to respond to an authentication request.": "vSBC-Metaswitch: Event: A RADIUS server failed to respond to an authentication request.", - "Event: All configured RADIUS servers failed to respond to authentication requests.": "vSBC-Metaswitch: Event: All configured RADIUS servers failed to respond to authentication requests.", - "Event: The number of CPUs has changed.": "vSBC-Metaswitch: Event: The number of CPUs has changed.", - "Event: A user has been automatically deleted": "vSBC-Metaswitch: Event: A user has been automatically deleted", - "The primary processor blade has lost management connectivity": "vSBC-Metaswitch: The primary processor blade has lost management connectivity", - "Event: A processor blade is running with DPDK mode disabled when DPDK mode is,expected.": "vSBC-Metaswitch: Event: A processor blade is running with DPDK mode disabled when DPDK mode is,expected.", - "Event: Processor blade %1 is running with DPDK mode disabled when DPDK mode may be possible.": "vSBC-Metaswitch: Event: Processor blade %1 is running with DPDK mode disabled when DPDK mode may be possible.", - "Perimeta is attempting to resend cached billing records.": "vSBC-Metaswitch: Perimeta is attempting to resend cached billing records.", - "The Rf billing cache is full.": "vSBC-Metaswitch: The Rf billing cache is full.", - "The inbound call queue is congested.": "vSBC-Metaswitch: The inbound call queue is congested.", - "A configured realm group contains realms that are not available to the SBC.": "vSBC-Metaswitch: A configured realm group contains realms that are not available to the SBC.", - "An allowed MSC configuration is not connected to any physical MSCs.": "vSBC-Metaswitch: An allowed MSC configuration is not connected to any physical MSCs.", - "An adjacency has failed as the listen socket could not be created. Check for configuration mismatches with the associated service interface.": "vSBC-Metaswitch: An adjacency has failed as the listen socket could not be created. Check for configuration mismatches with the associated service interface.", - "No suitable DNS records were found for a peer group's DNS hostname.": "vSBC-Metaswitch: No suitable DNS records were found for a peer group's DNS hostname.", - "One or more SIP peers from a peer group have stopped responding to SIP OPTIONS pings": "vSBC-Metaswitch: One or more SIP peers from a peer group have stopped responding to SIP OPTIONS pings", - "An adjacency has failed as its service network does not match the service network on its associated peer group.": "vSBC-Metaswitch: An adjacency has failed as its service network does not match the service network on its associated peer group.", - "An adjacency has failed as its configured TLS certificate could not be found.": "vSBC-Metaswitch: An adjacency has failed as its configured TLS certificate could not be found.", - "The caching function has not been initialized properly.": "vSBC-Metaswitch: The caching function has not been initialized properly.", - "An adjacency has failed as the listen socket could not be created.": "vSBC-Metaswitch: An adjacency has failed as the listen socket could not be created.", - "An adjacency is congested and may be rejecting calls.": "vSBC-Metaswitch: An adjacency is congested and may be rejecting calls.", - "There is an issue with a Diameter peer.": "vSBC-Metaswitch: There is an issue with a Diameter peer.", - "A realm is no longer reachable via any configured peers.": "vSBC-Metaswitch: A realm is no longer reachable via any configured peers.", - "An FQDN for a configured Diameter peer has failed to resolve to a valid IP address.": "vSBC-Metaswitch: An FQDN for a configured Diameter peer has failed to resolve to a valid IP address.", - "One or more peers resolved from a DNS lookup of a configured peer's address cannot be contacted": "vSBC-Metaswitch: One or more peers resolved from a DNS lookup of a configured peer's address cannot be contacted", - "An interface ARP or NDP probe has failed.": "vSBC-Metaswitch: An interface ARP or NDP probe has failed.", - "One or more IP address conflicts have been detected on service interfaces with zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.": "vSBC-Metaswitch: One or more IP address conflicts have been detected on service interfaces with zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.", - "One or more IP address conflicts have been detected on service interfaces with non-zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.": "vSBC-Metaswitch: One or more IP address conflicts have been detected on service interfaces with non-zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.", - "An interface device is running below the expected speed. This alarm was originally triggered by a probe failure on a service interface.": "vSBC-Metaswitch: An interface device is running below the expected speed. This alarm was originally triggered by a probe failure on a service interface.", - "An interface device is running above the expected speed.": "vSBC-Metaswitch: An interface device is running above the expected speed.", - "An IP address conflict has been detected on a management interface.": "vSBC-Metaswitch: An IP address conflict has been detected on a management interface.", - "An interface ICMP probe has failed.": "vSBC-Metaswitch: An interface ICMP probe has failed.", - "A High-Availability link has detected a connectivity issue.": "vSBC-Metaswitch: A High-Availability link has detected a connectivity issue.", - "An HA-link device is being reported as underspeed.": "vSBC-Metaswitch: An HA-link device is being reported as underspeed.", - "An IP address conflict has been detected on a replication interface.": "vSBC-Metaswitch: An IP address conflict has been detected on a replication interface.", - "The Session Controller has started.": "vSBC-Metaswitch: The Session Controller has started.", - "A statistic exceeded its configured thresholds.": "vSBC-Metaswitch: A statistic exceeded its configured thresholds.", - "One or more statistic has not been retrieved at least 3 times in a row.": "vSBC-Metaswitch: One or more statistic has not been retrieved at least 3 times in a row.", - "A Refresh Alarms request was triggered. Alarms not re-raised will be cleared in 5 minutes.": "vSBC-Metaswitch: A Refresh Alarms request was triggered. Alarms not re-raised will be cleared in 5 minutes.", - "A statistic has exceeded its configured thresholds.": "vSBC-Metaswitch: A statistic has exceeded its configured thresholds.", - "A Fallback Operation will soon be started": "vSBG: A Fallback Operation will soon be started", - "BRM, Auto Export Backup Failed": "vSBG: BRM, Auto Export Backup Failed", - "BRM, Scheduled Backup Failed": "vSBG: BRM, Scheduled Backup Failed", - "COM SA, AMF Component Cleanup Failed": "vSBG: COM SA, AMF Component Cleanup Failed", - "COM SA, AMF Component Instantiation Failed": "vSBG: COM SA, AMF Component Instantiation Failed", - "COM SA, AMF SI Unassigned": "vSBG: COM SA, AMF SI Unassigned", - "COM SA, CLM Cluster Node Unavailable": "vSBG: COM SA, CLM Cluster Node Unavailable", - "COM SA, MDF Detected Model Error": "vSBG: COM SA, MDF Detected Model Error", - "COM SA, Proxy Status of a Component Changed to Unproxied": "vSBG: COM SA, Proxy Status of a Component Changed to Unproxied", - "File Management, Number of Files in FileGroup Exceeded": "vSBG: File Management, Number of Files in FileGroup Exceeded", - "File Management, Max Size in FileGroup Exceeded": "vSBG: File Management, Max Size in FileGroup Exceeded", - "LOTC Disk Replication Communication": "vSBG: LOTC Disk Replication Communication", - "LOTC Disk Replication Consistency": "vSBG: LOTC Disk Replication Consistency", - "LOTC Disk Usage": "vSBG: LOTC Disk Usage", - "LOTC memory Usage": "vSBG: LOTC memory Usage", - "LOTC Time Synchronization": "vSBG: LOTC Time Synchronization", - "SBG, BGF Control Link Down": "vSBG: SBG, BGF Control Link Down", - "SBG, BGF Control Link Disabled": "vSBG: SBG, BGF Control Link Disabled", - "SBG, BGF Control Link Enabled": "vSBG: SBG, BGF Control Link Enabled", - "SBG, BGF Control Link Remote Locked": "vSBG: SBG, BGF Control Link Remote Locked", - "SBG, Charging Data Storage Maximum Records Reached": "vSBG: SBG, Charging Data Storage Maximum Records Reached", - "SBG, Charging Server Rejects Charging Data": "vSBG: SBG, Charging Server Rejects Charging Data", - "SBG, Excessive Packet Rate Detected ": "vSBG: SBG, Excessive Packet Rate Detected ", - "SBG, High Amount of Malformed Packets Received": "vSBG: SBG, High Amount of Malformed Packets Received", - "SBG, High Amount of STUN Packets Detected": "vSBG: SBG, High Amount of STUN Packets Detected", - "SBG, High Amount of TCP SYN Packets Received": "vSBG: SBG, High Amount of TCP SYN Packets Received", - "SBG, High Amount of UDP Packets Received ": "vSBG: SBG, High Amount of UDP Packets Received ", - "SBG, IP Address Blocked Due to Excessive Packet Rate": "vSBG: SBG, IP Address Blocked Due to Excessive Packet Rate", - "SBG, Lost Connectivity to Diameter Server": "vSBG: SBG, Lost Connectivity to Diameter Server", - "SBG, Mated Pair out of Service": "vSBG: SBG, Mated Pair out of Service", - "SBG, Network Unavailable for Media Handling": "vSBG: SBG, Network Unavailable for Media Handling", - "SBG, Non-emergency Call Released to Free Resources for Emergency Call": "vSBG: SBG, Non-emergency Call Released to Free Resources for Emergency Call", - "SBG, Not Enough Disk Space for Storing Charging Data": "vSBG: SBG, Not Enough Disk Space for Storing Charging Data", - "SBG, Payload Mated Pair Failure": "vSBG: SBG, Payload Mated Pair Failure", - "SBG, Payload Processor Failure": "vSBG: SBG, Payload Processor Failure", - "SBG, Processor Overloaded": "vSBG: SBG, Processor Overloaded", - "SBG, Registered User Set in Quarantine": "vSBG: SBG, Registered User Set in Quarantine", - "SBG, Registration Contacts Exceed Configured Threshold": "vSBG: SBG, Registration Contacts Exceed Configured Threshold", - "SBG, Sequential Restart Initiated": "vSBG: SBG, Sequential Restart Initiated", - "SBG, SIP Abuse Detected": "vSBG: SBG, SIP Abuse Detected", - "SBG, SIP Network Locked": "vSBG: SBG, SIP Network Locked", - "SBG, SIP Next Hop Reachable": "vSBG: SBG, SIP Next Hop Reachable", - "SBG, SIP Next Hop Unreachable": "vSBG: SBG, SIP Next Hop Unreachable", - "SBG, SIP Request Rejected by Network Throttling": "vSBG: SBG, SIP Request Rejected by Network Throttling", - "SBG, TLS Certificate Imported": "vSBG: SBG, TLS Certificate Imported", - "SBG, Trace Recording Session Number Limit Reached": "vSBG: SBG, Trace Recording Session Number Limit Reached", - "SBG, Trace Session Deactivated": "vSBG: SBG, Trace Session Deactivated", - "SBG, Trace Session Times Out": "vSBG: SBG, Trace Session Times Out", - "SBG, Unknown Media Type or Payload Type": "vSBG: SBG, Unknown Media Type or Payload Type" -} diff --git a/src/test/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructorTest.java b/src/test/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructorTest.java new file mode 100644 index 000000000..f16345676 --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/client/req/policy/GuardPolicyAttributesConstructorTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 Nokia Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.client.req.policy; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import org.assertj.core.api.Assertions; +import org.junit.Before; +import org.junit.Test; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Policy; +import org.onap.clamp.clds.model.properties.PolicyChain; +import org.onap.clamp.clds.model.properties.PolicyItem; +import org.onap.clamp.clds.util.ResourceFileUtil; +import org.onap.policy.api.AttributeType; +import org.onap.policy.controlloop.policy.builder.BuilderException; + +public class GuardPolicyAttributesConstructorTest { + + private static final String CONTROL_NAME = "ClosedLoop-d4629aee-970f-11e8-86c9-02552dda865e"; + private ModelProperties modelProperties; + private List<PolicyChain> policyChains; + + @Before + public void setUp() throws Exception { + String modelProp = ResourceFileUtil + .getResourceAsString("example/model-properties/tca_new/model-properties.json"); + String modelBpmnJson = ResourceFileUtil.getResourceAsString("example/model-properties/tca_new/model-bpmn.json"); + modelProperties = new ModelProperties("CLAMPDemoVFW_v1_0_3af8daec-6f10-4027-a3540", CONTROL_NAME, "PUT", false, + modelBpmnJson, modelProp); + + policyChains = modelProperties.getType(Policy.class).getPolicyChains(); + } + + @Test + public void testRequestAttributes() throws IOException, BuilderException { + List<PolicyItem> policyItemsList = GuardPolicyAttributesConstructor + .getAllPolicyGuardsFromPolicyChain(policyChains.get(0)); + + Assertions.assertThat(policyItemsList.size()).isEqualTo(1); + + // Test first entry + Map<AttributeType, Map<String, String>> requestAttributes = GuardPolicyAttributesConstructor + .formatAttributes(modelProperties, policyItemsList.get(0)); + + Assertions.assertThat(requestAttributes).containsKeys(AttributeType.MATCHING); + Map<String, String> ruleParameters = requestAttributes.get(AttributeType.MATCHING); + Assertions.assertThat(ruleParameters).contains(Assertions.entry(GuardPolicyAttributesConstructor.ACTOR, "APPC"), + Assertions.entry(GuardPolicyAttributesConstructor.RECIPE, "restart"), + Assertions.entry(GuardPolicyAttributesConstructor.TARGETS, ".*"), + Assertions.entry(GuardPolicyAttributesConstructor.CLNAME, + modelProperties.getControlNameAndPolicyUniqueId()), + Assertions.entry(GuardPolicyAttributesConstructor.LIMIT, "1"), + Assertions.entry(GuardPolicyAttributesConstructor.TIME_WINDOW, "10"), + Assertions.entry(GuardPolicyAttributesConstructor.TIME_UNITS, "minute"), + Assertions.entry(GuardPolicyAttributesConstructor.GUARD_ACTIVE_START, "00:00:01-05:00"), + Assertions.entry(GuardPolicyAttributesConstructor.GUARD_ACTIVE_END, "00:00:00-05:00")); + } +} diff --git a/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java b/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java index a6a209a1e..293f0e625 100644 --- a/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java +++ b/src/test/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyAttributesConstructorTest.java @@ -77,7 +77,7 @@ public class OperationalPolicyAttributesConstructorTest { // then Assertions.assertThat(requestAttributes).containsKeys(AttributeType.MATCHING, AttributeType.RULE); Assertions.assertThat(requestAttributes.get(AttributeType.MATCHING)) - .contains(Assertions.entry(OperationalPolicyAttributesConstructor.CONTROLLER, "amsterdam")); + .contains(Assertions.entry(OperationalPolicyAttributesConstructor.CONTROLLER, "amsterdam")); Map<String, String> ruleParameters = requestAttributes.get(AttributeType.RULE); Assertions.assertThat(ruleParameters).containsExactly( @@ -97,8 +97,8 @@ public class OperationalPolicyAttributesConstructorTest { // given ClampProperties mockClampProperties = createMockClampProperties( ImmutableMap.<String, String>builder().put("op.templateName", "ClosedLoopControlName") - .put("op.operationTopic", "APPP-CL").put("op.notificationTopic", "POLICY-CL-MGT") - .put("op.controller", "amsterdam").put("op.recipeTopic", "APPC").build()); + .put("op.operationTopic", "APPP-CL").put("op.notificationTopic", "POLICY-CL-MGT") + .put("op.controller", "amsterdam").put("op.recipeTopic", "APPC").build()); Policy expectedPolicy = new Policy("6f76ad0b-ea9d-4a92-8d7d-6a6367ce2c77", "healthCheck Policy", "healthCheck Policy - the trigger (no parent) policy - created by CLDS", "APPC", null, @@ -112,7 +112,7 @@ public class OperationalPolicyAttributesConstructorTest { // then Assertions.assertThat(requestAttributes).containsKeys(AttributeType.MATCHING, AttributeType.RULE); Assertions.assertThat(requestAttributes.get(AttributeType.MATCHING)) - .contains(Assertions.entry("controller", "amsterdam")); + .contains(Assertions.entry("controller", "amsterdam")); Map<String, String> ruleParameters = requestAttributes.get(AttributeType.RULE); Assertions.assertThat(ruleParameters).contains( @@ -127,7 +127,7 @@ public class OperationalPolicyAttributesConstructorTest { Assertions.assertThat(controlLoopPolicy.getControlLoop().getControlLoopName()).isEqualTo(CONTROL_NAME); Assertions.assertThat(controlLoopPolicy.getPolicies()).usingElementComparatorIgnoringFields("id") - .containsExactly(expectedPolicy); + .containsExactly(expectedPolicy); } private ClampProperties createMockClampProperties(ImmutableMap<String, String> propertiesMap) { diff --git a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java index 1a1621271..3f0a078bb 100644 --- a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java +++ b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java @@ -1,15 +1,15 @@ /*- * ============LICENSE_START======================================================= - * ONAP - SO + * 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. @@ -24,14 +24,11 @@ package org.onap.clamp.clds.config.sdc; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -46,19 +43,19 @@ import org.onap.clamp.clds.util.ResourceFileUtil; */ public class SdcSingleControllerConfigurationTest { - private SdcSingleControllerConfiguration loadControllerConfiguration(String fileName, String sdcControllerName) - throws IOException { + public static SdcSingleControllerConfiguration loadControllerConfiguration(String fileName, + String sdcControllerName) throws IOException { JsonNode jsonNode = new ObjectMapper().readValue(ResourceFileUtil.getResourceAsStream(fileName), - JsonNode.class); + JsonNode.class); SdcSingleControllerConfiguration sdcSingleControllerConfiguration = new SdcSingleControllerConfiguration( - jsonNode, sdcControllerName); + jsonNode, sdcControllerName); return sdcSingleControllerConfiguration; } @Test public final void testTheInit() throws SdcParametersException, IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-TLS.json", - "sdc-controller1"); + "sdc-controller1"); assertEquals("User", sdcConfig.getUser()); assertEquals("ThePassword", sdcConfig.getPassword()); assertEquals("consumerGroup", sdcConfig.getConsumerGroup()); @@ -78,7 +75,7 @@ public class SdcSingleControllerConfigurationTest { @Test(expected = SdcParametersException.class) public final void testAllRequiredParameters() throws IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-TLS.json", - "sdc-controller1"); + "sdc-controller1"); // No exception should be raised sdcConfig.testAllRequiredParameters(); sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-bad.json", "sdc-controller1"); @@ -86,10 +83,9 @@ public class SdcSingleControllerConfigurationTest { } @Test - public final void testAllRequiredParametersEmptyEncrypted() - throws IOException { + public final void testAllRequiredParametersEmptyEncrypted() throws IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration( - "clds/sdc-controller-config-empty-encrypted.json", "sdc-controller1"); + "clds/sdc-controller-config-empty-encrypted.json", "sdc-controller1"); sdcConfig.testAllRequiredParameters(); assertNull(sdcConfig.getKeyStorePassword()); } @@ -97,7 +93,7 @@ public class SdcSingleControllerConfigurationTest { @Test public final void testConsumerGroupWithNull() throws IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-NULL.json", - "sdc-controller1"); + "sdc-controller1"); assertTrue(sdcConfig.getConsumerGroup() == null); } } diff --git a/src/test/java/org/onap/clamp/clds/it/CldsDictionaryServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsDictionaryServiceItCase.java new file mode 100644 index 000000000..d31d5a01e --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/it/CldsDictionaryServiceItCase.java @@ -0,0 +1,161 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.it; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.Mockito; +import org.onap.clamp.clds.model.CldsDictionary; +import org.onap.clamp.clds.model.CldsDictionaryItem; +import org.onap.clamp.clds.service.CldsDictionaryService; +import org.onap.clamp.clds.util.LoggingUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.userdetails.User; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * Test CLDS Dictionary Service APIs. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class CldsDictionaryServiceItCase { + + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsDictionaryServiceItCase.class); + @Autowired + private CldsDictionaryService cldsDictionaryService; + private Authentication authentication; + private CldsDictionary cldsDictionary; + private CldsDictionaryItem cldsDictionaryItem; + private List<GrantedAuthority> authList = new LinkedList<GrantedAuthority>(); + private LoggingUtils util; + + /** + * Setup the variable before the tests execution. + * + * @throws IOException + * In case of issues when opening the files + */ + @Before + public void setupBefore() throws IOException { + authList.add(new SimpleGrantedAuthority("permission-type-cl|dev|read")); + authList.add(new SimpleGrantedAuthority("permission-type-cl|dev|update")); + authList.add(new SimpleGrantedAuthority("permission-type-template|dev|read")); + authList.add(new SimpleGrantedAuthority("permission-type-template|dev|update")); + authList.add(new SimpleGrantedAuthority("permission-type-filter-vf|dev|*")); + authList.add(new SimpleGrantedAuthority("permission-type-tosca|dev|read")); + authList.add(new SimpleGrantedAuthority("permission-type-tosca|dev|update")); + authentication = new UsernamePasswordAuthenticationToken(new User("admin", "", authList), "", authList); + + SecurityContext securityContext = Mockito.mock(SecurityContext.class); + Mockito.when(securityContext.getAuthentication()).thenReturn(authentication); + + util = Mockito.mock(LoggingUtils.class); + Mockito.doNothing().when(util).entering(Matchers.any(HttpServletRequest.class), Matchers.any(String.class)); + cldsDictionaryService.setLoggingUtil(util); + + cldsDictionaryService.setSecurityContext(securityContext); + + cldsDictionary = new CldsDictionary(); + + cldsDictionary.setDictionaryName("TestDictionary"); + ResponseEntity entity = cldsDictionaryService.createOrUpdateDictionary("TestDictionary", cldsDictionary); + cldsDictionary = (CldsDictionary) entity.getBody(); + + cldsDictionaryItem = new CldsDictionaryItem(); + cldsDictionaryItem.setDictElementShortName("TestDictionaryItemShortName"); + cldsDictionaryItem.setDictElementName("TestDictionaryItemName"); + cldsDictionaryItem.setDictElementType("string"); + cldsDictionaryItem.setDictionaryId(cldsDictionary.getDictionaryId()); + cldsDictionaryItem.setDictElementDesc("TestDictionaryItemDesc"); + cldsDictionaryService.createOrUpdateDictionaryElements("TestDictionary", cldsDictionaryItem); + + logger.info("Initial Clds Dictionary uploaded in DB:" + cldsDictionaryItem); + } + + @Test + public void testCreateOrUpdateDictionary() throws Exception { + ResponseEntity<CldsDictionary> responseEntity = cldsDictionaryService.createOrUpdateDictionary("TestDictionary", + cldsDictionary); + CldsDictionary dictionary = responseEntity.getBody(); + assertNotNull(dictionary); + logger.info("CLDS Dictionary is:" + dictionary); + assertEquals("TestDictionary", dictionary.getDictionaryName()); + } + + @Test + public void testCreateOrUpdateDictionaryElements() throws Exception { + cldsDictionaryItem = new CldsDictionaryItem(); + cldsDictionaryItem.setDictElementShortName("TestDictionaryItemShortName1"); + cldsDictionaryItem.setDictElementName("TestDictionaryItemName1"); + cldsDictionaryItem.setDictElementType("string"); + cldsDictionaryItem.setDictionaryId(cldsDictionary.getDictionaryId()); + cldsDictionaryItem.setDictElementDesc("TestDictionaryItemDesc1"); + + ResponseEntity<CldsDictionaryItem> responseEntity = cldsDictionaryService + .createOrUpdateDictionaryElements("TestDictionary", cldsDictionaryItem); + CldsDictionaryItem dictionaryItem = responseEntity.getBody(); + assertNotNull(dictionaryItem); + logger.info("CLDS Dictionary Item is:" + dictionaryItem); + assertEquals("TestDictionaryItemName1", dictionaryItem.getDictElementName()); + } + + @Test + public void testGetAllDictionaryNames() throws Exception { + ResponseEntity<List<CldsDictionary>> responseEntity = cldsDictionaryService.getAllDictionaryNames(); + List<CldsDictionary> dictionaries = responseEntity.getBody(); + assertNotNull(dictionaries); + logger.info("CLDS Dictionary List is:" + dictionaries); + } + + @Test + public void testGetDictionaryElementsByName() throws Exception { + ResponseEntity<List<CldsDictionaryItem>> responseEntity = cldsDictionaryService + .getDictionaryElementsByName("TestDictionary"); + List<CldsDictionaryItem> dictionaryItems = responseEntity.getBody(); + assertNotNull(dictionaryItems); + logger.info("CLDS Dictionary Item LIst is:" + dictionaryItems); + } +} diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java index e8d52c0ed..85218abb5 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java @@ -28,7 +28,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.io.IOException; import java.io.InputStream; @@ -54,6 +53,7 @@ import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsInfo; import org.onap.clamp.clds.model.CldsModel; +import org.onap.clamp.clds.model.CldsMonitoringDetails; import org.onap.clamp.clds.model.CldsServiceData; import org.onap.clamp.clds.model.CldsTemplate; import org.onap.clamp.clds.model.DcaeEvent; @@ -120,6 +120,7 @@ public class CldsServiceItCase { util = Mockito.mock(LoggingUtils.class); Mockito.doNothing().when(util).entering(Matchers.any(HttpServletRequest.class), Matchers.any(String.class)); cldsService.setLoggingUtil(util); + } @Test @@ -159,6 +160,12 @@ public class CldsServiceItCase { } @Test + public void testGetCLDSDetails() throws IOException { + List<CldsMonitoringDetails> cldsMonitoringDetailsList = cldsService.getCldsDetails(); + assertNotNull(cldsMonitoringDetailsList); + } + + @Test(expected = NotFoundException.class) public void testCompleteFlow() throws TransformerException, ParseException { SecurityContext securityContext = Mockito.mock(SecurityContext.class); Mockito.when(securityContext.getAuthentication()).thenReturn(authentication); @@ -190,6 +197,10 @@ public class CldsServiceItCase { // Test the PutModel method cldsService.putModel(randomNameModel, newModel); + + assertEquals(bpmnText, cldsService.getBpmnXml(randomNameModel)); + assertEquals(imageText, cldsService.getImageXml(randomNameModel)); + // Verify whether it has been added properly or not assertNotNull(cldsDao.getModel(randomNameModel)); @@ -248,13 +259,8 @@ public class CldsServiceItCase { assertNotNull(responseEntity); assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK)); assertNotNull(responseEntity.getBody()); - try { - cldsService.getModel(randomNameModel); - fail("Should have raised an NotFoundException exception"); - } catch (NotFoundException ne) { - - } - + // This will raise an exception + cldsService.getModel(randomNameModel); } @Test @@ -265,7 +271,8 @@ public class CldsServiceItCase { dcaeEvent.setResourceUUID("1"); dcaeEvent.setServiceUUID("2"); assertEquals(cldsService.postDcaeEvent("false", dcaeEvent), - "event=created serviceUUID=2 resourceUUID=1 artifactName=ClosedLoop_with-enough-characters_TestArtifact.yml instance count=0 isTest=false"); + "event=created serviceUUID=2 resourceUUID=1 artifactName=" + + "ClosedLoop_with-enough-characters_TestArtifact.yml instance count=0 isTest=false"); } @Test diff --git a/src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java new file mode 100644 index 000000000..d4c7e5c2a --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java @@ -0,0 +1,138 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.it; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.Mockito; +import org.onap.clamp.clds.model.CldsToscaModel; +import org.onap.clamp.clds.service.CldsToscaService; +import org.onap.clamp.clds.util.LoggingUtils; +import org.onap.clamp.clds.util.ResourceFileUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.userdetails.User; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +/** + * Test CLDS Tosca Service APIs. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class CldsToscaServiceItCase { + + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsToscaServiceItCase.class); + @Autowired + private CldsToscaService cldsToscaService; + private String toscaModelYaml; + private Authentication authentication; + private CldsToscaModel cldsToscaModel; + private List<GrantedAuthority> authList = new LinkedList<GrantedAuthority>(); + private LoggingUtils util; + + /** + * Setup the variable before the tests execution. + * + * @throws IOException + * In case of issues when opening the files + */ + @Before + public void setupBefore() throws IOException { + authList.add(new SimpleGrantedAuthority("permission-type-cl|dev|read")); + authList.add(new SimpleGrantedAuthority("permission-type-cl|dev|update")); + authList.add(new SimpleGrantedAuthority("permission-type-template|dev|read")); + authList.add(new SimpleGrantedAuthority("permission-type-template|dev|update")); + authList.add(new SimpleGrantedAuthority("permission-type-filter-vf|dev|*")); + authList.add(new SimpleGrantedAuthority("permission-type-tosca|dev|read")); + authList.add(new SimpleGrantedAuthority("permission-type-tosca|dev|update")); + authentication = new UsernamePasswordAuthenticationToken(new User("admin", "", authList), "", authList); + + SecurityContext securityContext = Mockito.mock(SecurityContext.class); + Mockito.when(securityContext.getAuthentication()).thenReturn(authentication); + + util = Mockito.mock(LoggingUtils.class); + Mockito.doNothing().when(util).entering(Matchers.any(HttpServletRequest.class), Matchers.any(String.class)); + cldsToscaService.setLoggingUtil(util); + + cldsToscaService.setSecurityContext(securityContext); + + toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tca-policy-test.yaml"); + + cldsToscaModel = new CldsToscaModel(); + cldsToscaModel.setToscaModelName("tca-policy-test"); + cldsToscaModel.setToscaModelYaml(toscaModelYaml); + cldsToscaModel.setUserId("admin"); + cldsToscaModel.setPolicyType("tca"); + cldsToscaService.parseToscaModelAndSave("tca-policy-test", cldsToscaModel); + logger.info("Initial Tosca Model uploaded in DB:" + cldsToscaModel); + } + + @Test + public void testParseToscaModelAndSave() throws Exception { + ResponseEntity responseEntity = cldsToscaService.parseToscaModelAndSave("tca-policy-test", cldsToscaModel); + CldsToscaModel savedModel = (CldsToscaModel) responseEntity.getBody(); + assertNotNull(savedModel); + logger.info("Parsed Tosca Model is:" + savedModel); + assertEquals("tca-policy-test", savedModel.getToscaModelName()); + } + + @Test + public void testGetToscaModel() throws Exception { + ResponseEntity<CldsToscaModel> responseEntity = cldsToscaService.getToscaModel("tca-policy-test"); + CldsToscaModel savedModel = responseEntity.getBody(); + assertNotNull(savedModel); + assertEquals("tca-policy-test", savedModel.getToscaModelName()); + } + + @Test + public void testGetToscaModelsByPolicyType() throws Exception { + ResponseEntity<CldsToscaModel> responseEntity = cldsToscaService.getToscaModelsByPolicyType("tca"); + CldsToscaModel savedModel = responseEntity.getBody(); + assertNotNull(savedModel); + assertEquals("tca-policy-test", savedModel.getToscaModelName()); + assertEquals("tca", savedModel.getPolicyType()); + } + +} diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java index 59fad9a69..31594cbac 100644 --- a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java @@ -24,156 +24,256 @@ package org.onap.clamp.clds.it; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - import java.io.IOException; +import java.util.List; import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; +import javax.xml.transform.TransformerException; + +import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.clamp.clds.client.req.policy.GuardPolicyAttributesConstructor; import org.onap.clamp.clds.client.req.policy.OperationalPolicyAttributesConstructor; import org.onap.clamp.clds.client.req.policy.PolicyClient; import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter; import org.onap.clamp.clds.config.ClampProperties; -import org.onap.clamp.clds.config.PolicyConfiguration; +import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.CldsEvent; +import org.onap.clamp.clds.model.CldsToscaModel; import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.model.properties.Policy; -import org.onap.clamp.clds.model.properties.PolicyChain; +import org.onap.clamp.clds.model.properties.PolicyItem; import org.onap.clamp.clds.model.properties.Tca; +import org.onap.clamp.clds.transform.XslTransformer; +import org.onap.clamp.clds.util.JacksonUtils; +import org.onap.clamp.clds.util.LoggingUtils; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.policy.api.AttributeType; +import org.onap.policy.api.PolicyConfigType; +import org.onap.policy.api.PolicyType; +import org.onap.policy.controlloop.policy.builder.BuilderException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** - * Test Policy API in org.onap.clamp.ClampDesigner.client package - replicate - * Policy Delegates in tests. + * Test Policy API, this uses the emulator written in python that is started + * during the tests, It returns the payload sent in the policy queries so that + * it can be validated here. */ @RunWith(SpringRunner.class) @SpringBootTest public class PolicyClientItCase { @Autowired - private PolicyConfiguration policyConfiguration; + private CldsDao cldsDao; @Autowired private ClampProperties refProp; @Autowired private PolicyClient policyClient; + @Autowired + XslTransformer cldsBpmnTransformer; String modelProp; - String modelBpmnProp; String modelName; String controlName; + String modelBpmnPropJson; + ModelProperties prop; - /** - * Initialize Test. - */ @Before - public void setUp() throws IOException { - modelProp = ResourceFileUtil.getResourceAsString("example/model-properties/policy/modelBpmnProperties.json"); - modelBpmnProp = ResourceFileUtil.getResourceAsString("example/model-properties/policy/modelBpmn.json"); + public void setUp() throws IOException, TransformerException { + modelProp = ResourceFileUtil.getResourceAsString("example/model-properties/tca_new/model-properties.json"); modelName = "example-model06"; controlName = "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf"; + modelBpmnPropJson = cldsBpmnTransformer.doXslTransformToString( + ResourceFileUtil.getResourceAsString("example/model-properties/tca_new/tca-template.xml")); + prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, false, modelBpmnPropJson, + modelProp); } - private void createUpdateOperationalPolicy(String actionCd) throws Exception { - ModelProperties prop = new ModelProperties(modelName, controlName, actionCd, false, modelBpmnProp, modelProp); - Policy policy = prop.getType(Policy.class); - if (policy.isFound()) { - for (PolicyChain policyChain : policy.getPolicyChains()) { - String operationalPolicyRequestUuid = UUID.randomUUID().toString(); - Map<AttributeType, Map<String, String>> attributes = OperationalPolicyAttributesConstructor - .formatAttributes(refProp, prop, policy.getId(), policyChain); - policyClient.sendBrmsPolicy(attributes, prop, operationalPolicyRequestUuid); - } - } + @Test + public void testSendGuardPolicy() throws TransformerException, IOException { + // Normally there is only one Guard + List<PolicyItem> policyItems = GuardPolicyAttributesConstructor + .getAllPolicyGuardsFromPolicyChain(prop.getType(Policy.class).getPolicyChains().get(0)); + PolicyItem policyItem = policyItems.get(0); + prop.setCurrentModelElementId(prop.getType(Policy.class).getId()); + prop.setPolicyUniqueId(prop.getType(Policy.class).getPolicyChains().get(0).getPolicyId()); + prop.setGuardUniqueId(policyItem.getId()); + String response = policyClient.sendGuardPolicy( + GuardPolicyAttributesConstructor.formatAttributes(prop, policyItem), prop, LoggingUtils.getRequestId(), + policyItem); + Map<String, Object> mapNodes = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(response), Map.class); + Assertions.assertThat(mapNodes).contains(Assertions.entry("policyClass", "Decision"), + Assertions.entry("policyName", + modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h_0_Guard_6TtHGPq"), + Assertions.entry("policyDescription", "from clds"), Assertions.entry("onapName", "PDPD"), + Assertions.entry("requestID", LoggingUtils.getRequestId()), Assertions.entry("ruleProvider", "GUARD_YAML")); + + // Check Guard attributes + Assertions.assertThat((Map<String, Object>) mapNodes.get("attributes")) + .containsKey(AttributeType.MATCHING.name()); + Assertions.assertThat( + (Map<String, Object>) ((Map<String, Object>) mapNodes.get("attributes")).get(AttributeType.MATCHING.name())) + .contains(Assertions.entry(GuardPolicyAttributesConstructor.ACTOR, "APPC"), + Assertions.entry(GuardPolicyAttributesConstructor.CLNAME, controlName + "_0"), + Assertions.entry(GuardPolicyAttributesConstructor.TIME_WINDOW, "10")); } - private void createUpdateTcaPolicy(String actionCd) throws Exception { - ModelProperties prop = new ModelProperties(modelName, controlName, actionCd, false, modelBpmnProp, modelProp); - Tca tca = prop.getType(Tca.class); - if (tca.isFound()) { - String tcaPolicyRequestUuid = UUID.randomUUID().toString(); - String policyJson = TcaRequestFormatter.createPolicyJson(refProp, prop); - try { - policyClient.sendMicroServiceInJson(policyJson, prop, tcaPolicyRequestUuid); - } catch (Exception e) { - assertTrue(e.getMessage().contains("Policy send failed: PE500 ")); - } - } + @Test + public void testSendBrmsPolicy() + throws TransformerException, BuilderException, IllegalArgumentException, IOException { + Map<AttributeType, Map<String, String>> attributes = OperationalPolicyAttributesConstructor.formatAttributes( + refProp, prop, prop.getType(Policy.class).getId(), prop.getType(Policy.class).getPolicyChains().get(0)); + String response = policyClient.sendBrmsPolicy(attributes, prop, LoggingUtils.getRequestId()); + + Map<String, Object> mapNodes = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(response), Map.class); + Assertions.assertThat(mapNodes).contains(Assertions.entry("policyClass", "Config"), + Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h_0"), + Assertions.entry("policyConfigType", PolicyConfigType.BRMS_PARAM.name()), + Assertions.entry("requestID", LoggingUtils.getRequestId())); + + // Check BRMS attributes present + Assertions.assertThat((Map<String, Object>) mapNodes.get("attributes")) + .containsKeys(AttributeType.MATCHING.name(), AttributeType.RULE.name()); + + } + + @Test + public void testSendMicroServiceInJson() + throws TransformerException, BuilderException, IllegalArgumentException, IOException { + prop.setCurrentModelElementId(prop.getType(Policy.class).getId()); + String jsonToSend = "{\"test\":\"test\"}"; + String response = policyClient.sendMicroServiceInJson(jsonToSend, prop, LoggingUtils.getRequestId()); + + Map<String, Object> mapNodes = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(response), Map.class); + Assertions.assertThat(mapNodes).contains(Assertions.entry("policyClass", "Config"), + Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h"), + Assertions.entry("policyConfigType", PolicyConfigType.MicroService.name()), + Assertions.entry("requestID", LoggingUtils.getRequestId()), + Assertions.entry("configBodyType", PolicyType.JSON.name()), Assertions.entry("onapName", "DCAE"), + Assertions.entry("configBody", jsonToSend)); + } - private void deleteOperationalPolicy(String actionCd) throws Exception { - ModelProperties prop = new ModelProperties(modelName, controlName, actionCd, false, modelBpmnProp, modelProp); - Policy policy = prop.getType(Policy.class); - if (policy.isFound()) { - prop.setCurrentModelElementId(policy.getId()); - for (PolicyChain policyChain : policy.getPolicyChains()) { - prop.setPolicyUniqueId(policyChain.getPolicyId()); - policyClient.deleteBrms(prop); - } - } + @Test + public void testSendBasePolicyInOther() throws IllegalArgumentException, IOException { + String body = "test"; + String response = policyClient.sendBasePolicyInOther(body, "myPolicy", prop, LoggingUtils.getRequestId()); + Map<String, Object> mapNodes = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(response), Map.class); + Assertions.assertThat(mapNodes).contains(Assertions.entry("policyClass", "Config"), + Assertions.entry("policyName", "myPolicy"), + Assertions.entry("policyConfigType", PolicyConfigType.Base.name()), + Assertions.entry("requestID", LoggingUtils.getRequestId()), + Assertions.entry("configBodyType", PolicyType.OTHER.name()), Assertions.entry("onapName", "DCAE"), + Assertions.entry("configBody", body)); } - private void deleteTcaPolicy(String actionCd) throws Exception { - ModelProperties prop = new ModelProperties(modelName, controlName, actionCd, false, modelBpmnProp, modelProp); + @Test + public void testSendMicroServiceInOther() throws IllegalArgumentException, IOException { Tca tca = prop.getType(Tca.class); - if (tca.isFound()) { - prop.setCurrentModelElementId(tca.getId()); - try { - policyClient.deleteMicrosService(prop); - } catch (Exception e) { - assertTrue(e.getMessage().contains("Policy delete failed: PE500 ")); - } - } + String tcaJson = TcaRequestFormatter.createPolicyJson(refProp, prop); + String response = policyClient.sendMicroServiceInOther(tcaJson, prop); + + Map<String, Object> mapNodes = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(response), Map.class); + Assertions.assertThat(mapNodes).contains(Assertions.entry("policyClass", "Config"), + Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_TCA_1d13unw"), + Assertions.entry("policyConfigType", PolicyConfigType.MicroService.name()), + Assertions.entry("configBody", tcaJson), Assertions.entry("onapName", "DCAE")); } - // @Test - /** - * Temporarily disabled Test. - */ - public void testCreateUpdateDeleteOperationalPolicy() throws Exception { - createUpdateOperationalPolicy(CldsEvent.ACTION_SUBMIT); - TimeUnit.SECONDS.sleep(20); - deleteOperationalPolicy(CldsEvent.ACTION_DELETE); + @Test + public void testDeleteMicrosService() throws IllegalArgumentException, IOException { + Tca tca = prop.getType(Tca.class); + prop.setCurrentModelElementId(tca.getId()); + String[] responses = policyClient.deleteMicrosService(prop).split("\\}\\{"); + + // There are 2 responses appended to the result, one for PDP one for PAP ! + Map<String, Object> mapNodesPdp = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(responses[0] + "}"), Map.class); + Map<String, Object> mapNodesPap = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree("{" + responses[1]), Map.class); + + Assertions.assertThat(mapNodesPdp).contains( + Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_TCA_1d13unw"), + Assertions.entry("policyType", PolicyConfigType.MicroService.name()), + Assertions.entry("policyComponent", "PDP"), Assertions.entry("deleteCondition", "ALL")); + + Assertions.assertThat(mapNodesPap).contains( + Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_TCA_1d13unw"), + Assertions.entry("policyType", PolicyConfigType.MicroService.name()), + Assertions.entry("policyComponent", "PAP"), Assertions.entry("deleteCondition", "ALL")); } @Test - public void testCreateUpdateDeleteTcaPolicy() throws Exception { - createUpdateTcaPolicy(CldsEvent.ACTION_SUBMIT); - TimeUnit.SECONDS.sleep(20); - deleteTcaPolicy(CldsEvent.ACTION_DELETE); + public void testDeleteGuard() throws IllegalArgumentException, IOException { + List<PolicyItem> policyItems = GuardPolicyAttributesConstructor + .getAllPolicyGuardsFromPolicyChain(prop.getType(Policy.class).getPolicyChains().get(0)); + prop.setCurrentModelElementId(prop.getType(Policy.class).getId()); + prop.setPolicyUniqueId(prop.getType(Policy.class).getPolicyChains().get(0).getPolicyId()); + prop.setGuardUniqueId(policyItems.get(0).getId()); + String[] responses = policyClient.deleteGuard(prop).split("\\}\\{"); + + // There are 2 responses appended to the result, one for PDP one for PAP ! + Map<String, Object> mapNodesPdp = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(responses[0] + "}"), Map.class); + Map<String, Object> mapNodesPap = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree("{" + responses[1]), Map.class); + + Assertions.assertThat(mapNodesPdp).contains( + Assertions.entry("policyName", + modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h_0_Guard_6TtHGPq"), + Assertions.entry("policyType", "Decision"), Assertions.entry("policyComponent", "PDP"), + Assertions.entry("deleteCondition", "ALL")); + Assertions.assertThat(mapNodesPap).contains( + Assertions.entry("policyName", + modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h_0_Guard_6TtHGPq"), + Assertions.entry("policyType", "Decision"), Assertions.entry("policyComponent", "PAP"), + Assertions.entry("deleteCondition", "ALL")); } @Test - public void testPolicyConfiguration() { - assertNotNull(policyConfiguration.getPdpUrl1()); - assertNotNull(policyConfiguration.getPdpUrl2()); - assertNotNull(policyConfiguration.getPapUrl()); - assertNotNull(policyConfiguration.getPolicyEnvironment()); - assertNotNull(policyConfiguration.getClientId()); - assertNotNull(policyConfiguration.getClientKey()); - assertNotNull(policyConfiguration.getNotificationType()); - assertNotNull(policyConfiguration.getNotificationUebServers()); - assertEquals(8, policyConfiguration.getProperties().size()); - assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL1)) - .contains("/pdp/ , testpdp, alpha123")); - assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL2)) - .contains("/pdp/ , testpdp, alpha123")); - assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PAP_URL)) - .contains("/pap/ , testpap, alpha123")); - assertEquals("websocket", policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_TYPE)); - assertEquals("localhost", - policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_UEB_SERVERS)); - assertEquals("python", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_ID)); - assertEquals("dGVzdA==", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_KEY)); - assertEquals("DEVL", policyConfiguration.getProperties().get(PolicyConfiguration.ENVIRONMENT)); + public void testDeleteBrms() throws IllegalArgumentException, IOException { + prop.setPolicyUniqueId(prop.getType(Policy.class).getPolicyChains().get(0).getPolicyId()); + prop.setCurrentModelElementId(prop.getType(Policy.class).getId()); + String[] responses = policyClient.deleteBrms(prop).split("\\}\\{"); + + // There are 2 responses appended to the result, one for PDP one for PAP ! + Map<String, Object> mapNodesPdp = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree(responses[0] + "}"), Map.class); + Map<String, Object> mapNodesPap = JacksonUtils.getObjectMapperInstance() + .convertValue(JacksonUtils.getObjectMapperInstance().readTree("{" + responses[1]), Map.class); + + Assertions.assertThat(mapNodesPdp).contains( + Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h_0"), + Assertions.entry("policyType", "BRMS_Param"), Assertions.entry("policyComponent", "PDP"), + Assertions.entry("deleteCondition", "ALL")); + Assertions.assertThat(mapNodesPap).contains( + Assertions.entry("policyName", modelName.replace("-", "_") + "." + controlName + "_Policy_12lup3h_0"), + Assertions.entry("policyType", "BRMS_Param"), Assertions.entry("policyComponent", "PAP"), + Assertions.entry("deleteCondition", "ALL")); + } + + @Test + public void testImportToscaModel() throws IOException { + String toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tca-policy-test.yaml"); + CldsToscaModel cldsToscaModel = new CldsToscaModel(); + cldsToscaModel.setToscaModelName("tca-policy-test"); + cldsToscaModel.setToscaModelYaml(toscaModelYaml); + cldsToscaModel.setUserId("admin"); + cldsToscaModel.setPolicyType("tca"); + cldsToscaModel = cldsToscaModel.save(cldsDao, refProp, policyClient, "test"); + String tosca = policyClient.importToscaModel(cldsToscaModel); + + Assertions.assertThat(tosca).contains( + "{\"serviceName\":\"tca-policy-test\",\"description\":\"tca-policy-test\",\"requestID\":null,\"filePath\":\"/tmp/tosca-models/tca-policy-test.yml\","); + Assertions.assertThat(tosca).contains(toscaModelYaml); } } diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyConfigurationItCase.java b/src/test/java/org/onap/clamp/clds/it/PolicyConfigurationItCase.java new file mode 100644 index 000000000..fd20e360a --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/it/PolicyConfigurationItCase.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.it; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.clamp.clds.config.PolicyConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +/** + * Test Config Policy read from application.properties. + */ +@RunWith(SpringRunner.class) +@SpringBootTest +public class PolicyConfigurationItCase { + + @Autowired + private PolicyConfiguration policyConfiguration; + + @Test + public void testPolicyConfiguration() { + assertNotNull(policyConfiguration.getPdpUrl1()); + assertNotNull(policyConfiguration.getPdpUrl2()); + assertNotNull(policyConfiguration.getPapUrl()); + assertNotNull(policyConfiguration.getPolicyEnvironment()); + assertNotNull(policyConfiguration.getClientId()); + assertNotNull(policyConfiguration.getClientKey()); + assertNotNull(policyConfiguration.getNotificationType()); + assertNotNull(policyConfiguration.getNotificationUebServers()); + assertEquals(8, policyConfiguration.getProperties().size()); + assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL1)) + .contains("/pdp/ , testpdp, alpha123")); + assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PDP_URL2)) + .contains("/pdp/ , testpdp, alpha123")); + assertTrue(((String) policyConfiguration.getProperties().get(PolicyConfiguration.PAP_URL)) + .contains("/pap/ , testpap, alpha123")); + assertEquals("websocket", policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_TYPE)); + assertEquals("localhost", + policyConfiguration.getProperties().get(PolicyConfiguration.NOTIFICATION_UEB_SERVERS)); + assertEquals("python", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_ID)); + assertEquals("dGVzdA==", policyConfiguration.getProperties().get(PolicyConfiguration.CLIENT_KEY)); + assertEquals("DEVL", policyConfiguration.getProperties().get(PolicyConfiguration.ENVIRONMENT)); + } +} diff --git a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java index 330ee6056..d36e14c2b 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java @@ -5,21 +5,21 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * 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 + * + * 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============================================ * Modifications copyright (c) 2018 Nokia * =================================================================== - * + * */ package org.onap.clamp.clds.it; @@ -157,7 +157,7 @@ public class SdcCatalogServicesItCase { rawCldsSdcResourceList.add(sdcResource2); SdcCatalogServices catalogServices = new SdcCatalogServices(); List<SdcResourceBasicInfo> resultList = catalogServices - .removeDuplicateSdcResourceBasicInfo(rawCldsSdcResourceList); + .removeDuplicateSdcResourceBasicInfo(rawCldsSdcResourceList); SdcResourceBasicInfo res1; SdcResourceBasicInfo res2; if ("resource1".equals(resultList.get(0).getName())) { @@ -173,15 +173,13 @@ public class SdcCatalogServicesItCase { assertTrue("1.0".equals(res2.getVersion())); } - @Test - public void removeDuplicateSdcFunctionShouldNotReturnNull(){ + public void removeDuplicateSdcFunctionShouldNotReturnNull() { // given SdcCatalogServices catalogServices = new SdcCatalogServices(); // when - List<SdcResourceBasicInfo> firstResult = catalogServices - .removeDuplicateSdcResourceBasicInfo(null); + List<SdcResourceBasicInfo> firstResult = catalogServices.removeDuplicateSdcResourceBasicInfo(null); List<SdcResourceBasicInfo> secondResult = catalogServices .removeDuplicateSdcResourceBasicInfo(new ArrayList<>()); @@ -194,8 +192,8 @@ public class SdcCatalogServicesItCase { public void getServiceUuidFromServiceInvariantIdTest() throws Exception { SdcCatalogServices spy = Mockito.spy(sdcCatalogWired); Mockito.doReturn(IOUtils.toString( - SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), - "UTF-8")).when(spy).getSdcServicesInformation(null); + SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8")) + .when(spy).getSdcServicesInformation(null); // Try the vcts4 version 1.0, this one should be replaced by 1.1 so it // should not exist, returning empty string String resUuidVcts4Null = spy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d9b"); @@ -216,81 +214,92 @@ public class SdcCatalogServicesItCase { public void getCldsServiceDataWithAlarmConditionsTest() throws Exception { SdcCatalogServices spy = Mockito.spy(sdcCatalogWired); Mockito.doReturn(IOUtils.toString( - SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), - "UTF-8")).when(spy).getSdcServicesInformation(null); + SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8")) + .when(spy).getSdcServicesInformation(null); // This invariant uuid is the one from vcts4 v1.1 String serviceResourceDetailUrl = refProp.getStringValue("sdc.serviceUrl") - + "/29018914-966c-442d-9d08-251b9dc45b8f/metadata"; + + "/29018914-966c-442d-9d08-251b9dc45b8f/metadata"; Mockito.doReturn(IOUtils.toString( - SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcServiceDetailsExample.json"), - "UTF-8")).when(spy).getCldsServicesOrResourcesBasedOnURL(serviceResourceDetailUrl); + SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcServiceDetailsExample.json"), "UTF-8")) + .when(spy).getCldsServicesOrResourcesBasedOnURL(serviceResourceDetailUrl); String resourceDetailUrl = refProp.getStringValue("sdc.catalog.url") - + "resources/585822c7-4027-4f84-ba50-e9248606f136/metadata"; + + "resources/585822c7-4027-4f84-ba50-e9248606f136/metadata"; Mockito.doReturn(IOUtils.toString( - SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcResourceDetailsExample.json"), - "UTF-8")).when(spy).getCldsServicesOrResourcesBasedOnURL(resourceDetailUrl); + SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcResourceDetailsExample.json"), "UTF-8")) + .when(spy).getCldsServicesOrResourcesBasedOnURL(resourceDetailUrl); String securityRulesDetailUrl = refProp.getStringValue("sdc.catalog.url") - + "resources/d57e57d2-e3c6-470d-8d16-e6ea05f536c5/metadata"; - Mockito.doReturn(IOUtils.toString( + + "resources/d57e57d2-e3c6-470d-8d16-e6ea05f536c5/metadata"; + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcSecurityRules.json"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(securityRulesDetailUrl); + .when(spy).getCldsServicesOrResourcesBasedOnURL(securityRulesDetailUrl); String cinderVolumeDetailUrl = refProp.getStringValue("sdc.catalog.url") - + "resources/b4288e07-597a-44a2-aa98-ad36e551a39d/metadata"; - Mockito.doReturn(IOUtils.toString( + + "resources/b4288e07-597a-44a2-aa98-ad36e551a39d/metadata"; + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcCinderVolume.json"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(cinderVolumeDetailUrl); + .when(spy).getCldsServicesOrResourcesBasedOnURL(cinderVolumeDetailUrl); String vfcGenericDetailUrl = refProp.getStringValue("sdc.catalog.url") - + "resources/2c8f1219-8000-4001-aa13-496a0396d40f/metadata"; + + "resources/2c8f1219-8000-4001-aa13-496a0396d40f/metadata"; Mockito.doReturn(IOUtils.toString( - SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcVFCGenericWithAlarms.json"), - "UTF-8")).when(spy).getCldsServicesOrResourcesBasedOnURL(vfcGenericDetailUrl); + SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcVFCGenericWithAlarms.json"), "UTF-8")) + .when(spy).getCldsServicesOrResourcesBasedOnURL(vfcGenericDetailUrl); String csvAlarmsDetailUrl = refProp.getStringValue("sdc.catalog.url") - + "resources/2c8f1219-8000-4001-aa13-496a0396d40f/resourceInstances/virc_fe_be/artifacts/5138e316-0237-49aa-817a-b3d8eaf77392"; - Mockito.doReturn(IOUtils.toString( + + "resources/2c8f1219-8000-4001-aa13-496a0396d40f/resourceInstances/virc_fe_be/" + + "artifacts/5138e316-0237-49aa-817a-b3d8eaf77392"; + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcAlarmsList.csv"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(csvAlarmsDetailUrl); - Mockito.doReturn(IOUtils.toString( + .when(spy).getCldsServicesOrResourcesBasedOnURL(csvAlarmsDetailUrl); + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcAlarmsList.csv"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(csvAlarmsDetailUrl); + .when(spy).getCldsServicesOrResourcesBasedOnURL(csvAlarmsDetailUrl); String csvAlarmsDetailUrl2 = refProp.getStringValue("sdc.catalog.url") - + "resources/d7646638-2572-4a94-b497-c028ac15f9ca/artifacts/5138e316-0237-49aa-817a-b3d8eaf77392"; - Mockito.doReturn(IOUtils.toString( + + "resources/d7646638-2572-4a94-b497-c028ac15f9ca/artifacts/5138e316-0237-49aa-817a-b3d8eaf77392"; + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcAlarmsList.csv"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(csvAlarmsDetailUrl2); + .when(spy).getCldsServicesOrResourcesBasedOnURL(csvAlarmsDetailUrl2); String allVfResourcesDetailUrl = refProp.getStringValue("sdc.catalog.url") + "resources?resourceType=VF"; - Mockito.doReturn(IOUtils.toString( + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcVFResources.json"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(allVfResourcesDetailUrl); + .when(spy).getCldsServicesOrResourcesBasedOnURL(allVfResourcesDetailUrl); String vfcResourcesDetailUrl = refProp.getStringValue("sdc.catalog.url") - + "resources/a0475018-1e7e-4ddd-8bee-33cbf958c2e6/metadata"; + + "resources/a0475018-1e7e-4ddd-8bee-33cbf958c2e6/metadata"; Mockito.doReturn(IOUtils.toString( - SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcCVFCResourceExample.json"), - "UTF-8")).when(spy).getCldsServicesOrResourcesBasedOnURL(vfcResourcesDetailUrl); + SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcCVFCResourceExample.json"), "UTF-8")) + .when(spy).getCldsServicesOrResourcesBasedOnURL(vfcResourcesDetailUrl); String allVfcResourcesDetailUrl = refProp.getStringValue("sdc.catalog.url") + "resources?resourceType=VFC"; - Mockito.doReturn(IOUtils.toString( + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcVFCResources.json"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(allVfcResourcesDetailUrl); + .when(spy).getCldsServicesOrResourcesBasedOnURL(allVfcResourcesDetailUrl); String allCvfcResourcesDetailUrl = refProp.getStringValue("sdc.catalog.url") + "resources?resourceType=CVFC"; - Mockito.doReturn(IOUtils.toString( + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcCVFCResources.json"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(allCvfcResourcesDetailUrl); + .when(spy).getCldsServicesOrResourcesBasedOnURL(allCvfcResourcesDetailUrl); String allVfAlarms = refProp.getStringValue("sdc.catalog.url") - + "resources/84855843-5247-4e97-a2bd-5395a510253b/artifacts/d57ac7ec-f3c3-4793-983a-c75ac3a43153"; - Mockito.doReturn(IOUtils.toString( + + "resources/84855843-5247-4e97-a2bd-5395a510253b/artifacts/d57ac7ec-f3c3-4793-983a-c75ac3a43153"; + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcMeasurementsList.csv"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(allVfAlarms); + .when(spy).getCldsServicesOrResourcesBasedOnURL(allVfAlarms); String vfcResourceExample = refProp.getStringValue("sdc.catalog.url") - + "resources/d7646638-2572-4a94-b497-c028ac15f9ca/metadata"; - Mockito.doReturn(IOUtils.toString( + + "resources/d7646638-2572-4a94-b497-c028ac15f9ca/metadata"; + Mockito + .doReturn(IOUtils.toString( SdcCatalogServicesItCase.class.getResourceAsStream("/example/sdc/sdcVFCResourceExample.json"), "UTF-8")) - .when(spy).getCldsServicesOrResourcesBasedOnURL(vfcResourceExample); + .when(spy).getCldsServicesOrResourcesBasedOnURL(vfcResourceExample); CldsServiceData cldsServiceData = spy - .getCldsServiceDataWithAlarmConditions("a33ed748-3477-4434-b3f3-b5560f5e7d9c"); + .getCldsServiceDataWithAlarmConditions("a33ed748-3477-4434-b3f3-b5560f5e7d9c"); assertTrue("a33ed748-3477-4434-b3f3-b5560f5e7d9c".equals(cldsServiceData.getServiceInvariantUUID())); assertTrue("29018914-966c-442d-9d08-251b9dc45b8f".equals(cldsServiceData.getServiceUUID())); assertTrue(cldsServiceData.getCldsVfs().size() == 1); List<CldsAlarmCondition> alarmsList = spy.getAllAlarmConditionsFromCldsServiceData(cldsServiceData, - "alarmCondition"); + "alarmCondition"); assertTrue(alarmsList.size() == 12); } } diff --git a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java index f05b33e10..971b36f6f 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java @@ -18,7 +18,7 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.it; @@ -68,7 +68,7 @@ public class SdcReqItCase { modelName = "example-model01"; controlName = "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf"; modelProperties = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, false, modelBpmn, - modelBpmnProp); + modelBpmnProp); jsonWithYamlInside = ResourceFileUtil.getResourceAsString("example/tca-policy-req/prop-text.json"); } @@ -76,26 +76,23 @@ public class SdcReqItCase { public void formatBlueprintTest() throws IOException { String blueprintFormatted = sdcReq.formatBlueprint(modelProperties, jsonWithYamlInside); assertEquals(ResourceFileUtil.getResourceAsString("example/tca-policy-req/blueprint-expected.yaml"), - blueprintFormatted); + blueprintFormatted); } @Test public void formatSdcLocationsReqTest() { String blueprintFormatted = sdcReq.formatSdcLocationsReq(modelProperties, "testos"); assertEquals( - "{\"artifactName\":\"testos\",\"locations\":[\"SNDGCA64\",\"ALPRGAED\",\"LSLEILAA\",\"MDTWNJC1\"]}", - blueprintFormatted); + "{\"artifactName\":\"testos\",\"locations\":[\"SNDGCA64\",\"ALPRGAED\",\"LSLEILAA\",\"MDTWNJC1\"]}", + blueprintFormatted); } @Test public void formatSdcReqTest() throws JSONException { - String jsonResult = sdcReq.formatSdcReq("payload", "artifactName", - "artifactLabel", "artifactType"); - JSONAssert.assertEquals( - "{\"payloadData\" : \"cGF5bG9hZA==\",\"artifactLabel\" : \"artifactLabel\"," + - "\"artifactName\" :\"artifactName\",\"artifactType\" : \"artifactType\"," - + "\"artifactGroupType\" : \"DEPLOYMENT\",\"description\" : \"from CLAMP Cockpit\"}", - jsonResult, true); + String jsonResult = sdcReq.formatSdcReq("payload", "artifactName", "artifactLabel", "artifactType"); + JSONAssert.assertEquals("{\"payloadData\" : \"cGF5bG9hZA==\",\"artifactLabel\" : \"artifactLabel\"," + + "\"artifactName\" :\"artifactName\",\"artifactType\" : \"artifactType\"," + + "\"artifactGroupType\" : \"DEPLOYMENT\",\"description\" : \"from CLAMP Cockpit\"}", jsonResult, true); } @Test @@ -104,6 +101,6 @@ public class SdcReqItCase { assertNotNull(listUrls); assertTrue(listUrls.size() == 1); assertTrue(listUrls.get(0).contains( - "/sdc/v1/catalog/services/56441b4b-0467-41dc-9a0e-e68613838219/resourceInstances/vpacketgen0/artifacts")); + "/sdc/v1/catalog/services/56441b4b-0467-41dc-9a0e-e68613838219/resourceInstances/vpacketgen0/artifacts")); } } diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java index 95e29c034..9d58ba8f0 100644 --- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java @@ -18,7 +18,7 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.it.config; @@ -26,10 +26,12 @@ package org.onap.clamp.clds.it.config; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; +import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; @@ -64,7 +66,7 @@ public class CldsReferencePropertiesItCase { * Test getting prop value as a JSON Node / template. * * @throws IOException - * when JSON parsing fails + * when JSON parsing fails */ @Test public void testGetJsonTemplate() throws IOException { @@ -85,7 +87,7 @@ public class CldsReferencePropertiesItCase { * Test getting prop value as a JSON Node / template. * * @throws IOException - * when JSON parsing fails + * when JSON parsing fails */ @Test public void testGetFileContent() throws IOException { @@ -95,4 +97,13 @@ public class CldsReferencePropertiesItCase { content = refProp.getFileContent("sdc.decode", "service_ids"); assertEquals("{}", content); } + + @Test + public void testGetStringList() { + List<String> profileList = refProp.getStringList("policy.pdpUrl1", ","); + assertTrue(profileList.size() == 3); + assertTrue(profileList.get(0).trim().startsWith("http://localhost:")); + assertTrue(profileList.get(1).trim().equals("testpdp")); + assertTrue(profileList.get(2).trim().equals("alpha123")); + } } diff --git a/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java b/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java index 4b632488a..0cab4b9d3 100644 --- a/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/config/SdcControllersConfigurationItCase.java @@ -1,15 +1,15 @@ /*- * ============LICENSE_START======================================================= - * ONAP - SO + * 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. @@ -56,7 +56,7 @@ public class SdcControllersConfigurationItCase { public void testGetAllDefinedControllers() throws IOException { loadFile("classpath:/clds/sdc-controllers-config.json"); Map<String, SdcSingleControllerConfiguration> mapResult = sdcControllersConfiguration - .getAllDefinedControllers(); + .getAllDefinedControllers(); assertTrue(mapResult.size() == 2); assertEquals("sdc-controller1", mapResult.get("sdc-controller1").getSdcControllerName()); assertEquals("sdc-controller2", mapResult.get("sdc-controller2").getSdcControllerName()); @@ -65,10 +65,10 @@ public class SdcControllersConfigurationItCase { @Test public void testGetSdcSingleControllerConfiguration() throws IOException { loadFile("classpath:/clds/sdc-controllers-config.json"); - assertEquals("sdc-controller1", sdcControllersConfiguration - .getSdcSingleControllerConfiguration("sdc-controller1").getSdcControllerName()); - assertEquals("sdc-controller2", sdcControllersConfiguration - .getSdcSingleControllerConfiguration("sdc-controller2").getSdcControllerName()); + assertEquals("sdc-controller1", + sdcControllersConfiguration.getSdcSingleControllerConfiguration("sdc-controller1").getSdcControllerName()); + assertEquals("sdc-controller2", + sdcControllersConfiguration.getSdcSingleControllerConfiguration("sdc-controller2").getSdcControllerName()); } @Test(expected = IOException.class) diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java new file mode 100644 index 000000000..9eaca5f73 --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.it.sdc.controller; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.assertj.core.api.Assertions; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.onap.clamp.clds.config.ClampProperties; +import org.onap.clamp.clds.config.sdc.SdcSingleControllerConfigurationTest; +import org.onap.clamp.clds.sdc.controller.SdcSingleController; +import org.onap.clamp.clds.sdc.controller.installer.CsarHandler; +import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller; +import org.onap.sdc.api.notification.IArtifactInfo; +import org.onap.sdc.api.notification.INotificationData; +import org.onap.sdc.api.notification.IResourceInstance; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SdcSingleControllerItCase { + + private static final String SDC_FOLDER = "/tmp/csar-handler-tests"; + private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar"; + private static final String SERVICE_UUID = "serviceUUID"; + private static final String RESOURCE1_UUID = "resource1UUID"; + private static final String RESOURCE1_INSTANCE_NAME = "sim-1802 0"; + private static final String RESOURCE1_INSTANCE_NAME_IN_CSAR = "sim18020"; + private static final String BLUEPRINT1_NAME = "FOI.Simfoimap223S0112.event_proc_bp.yaml"; + + @Autowired + private ClampProperties clampProp; + + private SdcSingleController sdcSingleController; + + private INotificationData buildFakeSdcNotification() { + // BUild what is needed for CSAR + IArtifactInfo serviceArtifact = Mockito.mock(IArtifactInfo.class); + Mockito.when(serviceArtifact.getArtifactType()).thenReturn(CsarHandler.CSAR_TYPE); + Mockito.when(serviceArtifact.getArtifactName()).thenReturn(CSAR_ARTIFACT_NAME); + List<IArtifactInfo> servicesList = new ArrayList<>(); + servicesList.add(serviceArtifact); + INotificationData notifData = Mockito.mock(INotificationData.class); + Mockito.when(notifData.getServiceArtifacts()).thenReturn(servicesList); + // Build what is needed for UUID + Mockito.when(notifData.getServiceInvariantUUID()).thenReturn(SERVICE_UUID); + // Build fake resource with one artifact BLUEPRINT + IResourceInstance resource1 = Mockito.mock(IResourceInstance.class); + Mockito.when(resource1.getResourceType()).thenReturn("VF"); + Mockito.when(resource1.getResourceInvariantUUID()).thenReturn(RESOURCE1_UUID); + Mockito.when(resource1.getResourceInstanceName()).thenReturn(RESOURCE1_INSTANCE_NAME); + // Create a fake artifact for resource + IArtifactInfo blueprintArtifact = Mockito.mock(IArtifactInfo.class); + Mockito.when(blueprintArtifact.getArtifactType()).thenReturn(CsarHandler.BLUEPRINT_TYPE); + List<IArtifactInfo> artifactsListForResource = new ArrayList<>(); + artifactsListForResource.add(blueprintArtifact); + Mockito.when(resource1.getArtifacts()).thenReturn(artifactsListForResource); + List<IResourceInstance> resourcesList = new ArrayList<>(); + resourcesList.add(resource1); + Mockito.when(notifData.getResources()).thenReturn(resourcesList); + return notifData; + } + + @Before + public void init() throws IOException { + sdcSingleController = new SdcSingleController(clampProp, Mockito.mock(CsarInstaller.class), + SdcSingleControllerConfigurationTest.loadControllerConfiguration("clds/sdc-controller-config-TLS.json", + "sdc-controller1"), + null) { + }; + } + + @Test + public void testTreatNotification() { + sdcSingleController.treatNotification(buildFakeSdcNotification()); + Assertions.assertThat(sdcSingleController.getNbOfNotificationsOngoing()).isEqualTo(0); + + } + +} diff --git a/src/test/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfoTest.java b/src/test/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfoTest.java new file mode 100644 index 000000000..119fd2181 --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfoTest.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2018 Nokia + * ================================================================================ + * + */ + +package org.onap.clamp.clds.model.sdc; + +import org.assertj.core.api.Assertions; +import org.junit.Test; + +public class SdcResourceBasicInfoTest { + + @Test + public void testHashCode() { + SdcResourceBasicInfo sdc1a = new SdcResourceBasicInfo(); + SdcResourceBasicInfo sdc1b = new SdcResourceBasicInfo(); + SdcResourceBasicInfo sdc2 = new SdcResourceBasicInfo(); + sdc1a.setName("test1"); + sdc1a.setVersion("1.0"); + sdc1b.setName("test1"); + sdc1b.setVersion("2.0"); + sdc2.setName("test2"); + sdc2.setVersion("2.0"); + + Assertions.assertThat(sdc1a.hashCode()).isNotEqualTo(sdc1b.hashCode()); + Assertions.assertThat(sdc1b.hashCode()).isNotEqualTo(sdc2.hashCode()); + sdc1b.setVersion("1.0"); + Assertions.assertThat(sdc1a.hashCode()).isEqualTo(sdc1b.hashCode()); + + } + + @Test + public void testCompareTo() { + SdcResourceBasicInfo sdc1a = new SdcResourceBasicInfo(); + SdcResourceBasicInfo sdc1b = new SdcResourceBasicInfo(); + SdcResourceBasicInfo sdc2 = new SdcResourceBasicInfo(); + sdc1a.setName("test1"); + sdc1a.setVersion("1.0"); + sdc1b.setName("test1"); + sdc1b.setVersion("2.0"); + sdc2.setName("test2"); + sdc2.setVersion("2.0"); + + Assertions.assertThat(sdc1a.compareTo(sdc1b)).isEqualTo(-1); + Assertions.assertThat(sdc1b.compareTo(sdc1a)).isEqualTo(1); + Assertions.assertThat(sdc1a.compareTo(sdc1a)).isEqualTo(0); + Assertions.assertThat(sdc1a.compareTo(sdc2)).isEqualTo(-1); + } + + @Test + public void testEquals() { + SdcResourceBasicInfo sdc1a = new SdcResourceBasicInfo(); + SdcResourceBasicInfo sdc1b = new SdcResourceBasicInfo(); + SdcResourceBasicInfo sdc2 = new SdcResourceBasicInfo(); + sdc1a.setName("test1"); + sdc1a.setVersion("1.0"); + sdc1b.setName("test1"); + sdc1b.setVersion("2.0"); + sdc2.setName("test2"); + sdc2.setVersion("2.0"); + + Assertions.assertThat(sdc1a.equals(sdc1a)).isTrue(); + Assertions.assertThat(sdc1a.equals(sdc1b)).isFalse(); + + sdc1b.setVersion(null); + Assertions.assertThat(sdc1a.equals(sdc1b)).isFalse(); + sdc1b.setVersion("1.0"); + Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); + sdc1a.setVersion(null); + sdc1b.setVersion(null); + Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); + + sdc1b.setName(null); + Assertions.assertThat(sdc1a.equals(sdc1b)).isFalse(); + sdc1b.setName("test1"); + Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); + sdc1a.setName(null); + sdc1b.setName(null); + Assertions.assertThat(sdc1a.equals(sdc1b)).isTrue(); + } + +} diff --git a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java new file mode 100644 index 000000000..d94ffabaf --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.tosca; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + +import org.junit.Test; +import org.onap.clamp.clds.util.ResourceFileUtil; +import org.skyscreamer.jsonassert.JSONAssert; + +public class ToscaYamlToJsonConvertorTest { + + /** + * This Test validates TOSCA yaml to JSON Schema conversion based on JSON Editor + * Schema. + * + * @throws IOException + * + */ + @Test + public final void testParseToscaYaml() throws IOException { + String toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"); + ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(null); + + String parsedJsonSchema = convertor.parseToscaYaml(toscaModelYaml); + assertNotNull(parsedJsonSchema); + JSONAssert.assertEquals( + ResourceFileUtil.getResourceAsString("example/json-editor-schema/tca-policy-json-editor-schema.json"), + parsedJsonSchema, true); + } +} diff --git a/src/test/java/org/onap/clamp/clds/util/JacksonUtilsTest.java b/src/test/java/org/onap/clamp/clds/util/JacksonUtilsTest.java index e482d6870..1d9e4e79d 100644 --- a/src/test/java/org/onap/clamp/clds/util/JacksonUtilsTest.java +++ b/src/test/java/org/onap/clamp/clds/util/JacksonUtilsTest.java @@ -5,20 +5,20 @@ * Copyright (C) 2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.util; @@ -73,21 +73,22 @@ public class JacksonUtilsTest { /** * This method test that the security hole in Jackson is not enabled in the * default ObjectMapper. - * + * * @throws JsonParseException - * In case of issues + * In case of issues * @throws JsonMappingException - * In case of issues + * In case of issues * @throws IOException - * In case of issues + * In case of issues */ @Test public void testCreateBeanDeserializer() throws JsonParseException, JsonMappingException, IOException { TestClass test = new TestClass("value1", "value2"); test.setObject2(new TestObject2("test3")); - Object testObject = JacksonUtils.getObjectMapperInstance().readValue( - "[\"org.onap.clamp.clds.util.JacksonUtilsTest$TestClass\",{\"test\":\"value1\",\"test2\":\"value2\",\"object2\":[\"org.onap.clamp.clds.util.TestObject2\",{\"test3\":\"test3\"}]}]", - Object.class); + Object testObject = JacksonUtils.getObjectMapperInstance() + .readValue("[\"org.onap.clamp.clds.util.JacksonUtilsTest$TestClass\"" + + ",{\"test\":\"value1\",\"test2\":\"value2\",\"object2\":[\"org.onap.clamp.clds.util.TestObject2\"," + + "{\"test3\":\"test3\"}]}]", Object.class); assertNotNull(testObject); assertFalse(testObject instanceof TestObject); assertFalse(testObject instanceof TestClass); diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index aa43ea2e6..d75c60869 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -30,7 +30,7 @@ info.build.version=@project.version@ ### (See below for the parameter 'server.http.port' if you want to have both enabled)
### To have only HTTP, keep the lines server.ssl.* commented
### To have only HTTPS enabled, uncomment the server.ssl.* lines and specify a right keystore location
-server.port=8080
+server.port=${clamp.it.tests.http}
### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port')
#server.ssl.key-store=file:/tmp/mykey.jks
#server.ssl.key-store-password=pass
@@ -122,7 +122,6 @@ clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json # DCAE request build properties
#
clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
-clamp.config.dcae.decode.service_ids=classpath:/clds/templates/dcae-decode-service_ids.json
clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
#
# SDC request blueprint properties
@@ -155,6 +154,10 @@ clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_ clamp.config.policy.base.policyNamePrefix=Config_
clamp.config.policy.op.type=BRMS_Param
+clamp.config.import.tosca.model=false
+clamp.config.tosca.policyTypes=tca
+clamp.config.tosca.filePath=/tmp/tosca-models
+
# TCA MicroService Policy request build properties
#
clamp.config.tca.policyid.prefix=DCAE.Config_
@@ -188,11 +191,10 @@ clamp.config.sdc.locationArtifactType=DCAE_INVENTORY_JSON clamp.config.sdc.InstanceID=X-ECOMP-InstanceID
clamp.config.sdc.header.requestId = X-ECOMP-RequestID
#
-clamp.config.sdc.csarFolder = /tmp/sdc-tests
+clamp.config.sdc.csarFolder = ${project.build.directory}/sdc-tests
clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
#
clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
-clamp.config.ui.alarm.default=classpath:/clds/templates/ui-alarm-default.json
#
# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
clamp.config.action.test.override=false
@@ -217,5 +219,7 @@ clamp.config.security.permission.type.cl.manage=permission-type-cl-manage clamp.config.security.permission.type.cl.event=permission-type-cl-event
clamp.config.security.permission.type.filter.vf=permission-type-filter-vf
clamp.config.security.permission.type.template=permission-type-template
+clamp.config.security.permission.type.tosca=permission-type-tosca
#This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties
-clamp.config.security.permission.instance=dev
\ No newline at end of file +clamp.config.security.permission.instance=dev
+clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal
\ No newline at end of file diff --git a/src/test/resources/clds/camel/routes/flexible-flow.xml b/src/test/resources/clds/camel/routes/flexible-flow.xml new file mode 100644 index 000000000..2103b4acf --- /dev/null +++ b/src/test/resources/clds/camel/routes/flexible-flow.xml @@ -0,0 +1,61 @@ +<routes xmlns="http://camel.apache.org/schema/spring"> + <route id="submit"> + <from uri="direct:processSubmit" /> + <choice> + <when> + <simple> ${exchangeProperty.actionCd} == 'SUBMIT' || ${exchangeProperty.actionCd} == 'RESUBMIT'</simple> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" /> + <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" /> + <delay> + <constant>30000</constant> + </delay> + <to uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" /> + </when> + <when> + <simple> ${exchangeProperty.actionCd} == 'DELETE'</simple> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" /> + <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDeleteDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDeleteDelegate" /> + <delay> + <constant>30000</constant> + </delay> + <to + uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.ModelDeleteDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" /> + </when> + <when> + <simple> ${exchangeProperty.actionCd} == 'UPDATE'</simple> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" /> + <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" /> + <delay> + <constant>30000</constant> + </delay> + <to uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" /> + </when> + <when> + <simple> ${exchangeProperty.actionCd} == 'STOP'</simple> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" /> + <to + uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" /> + </when> + <when> + <simple> ${exchangeProperty.actionCd} == 'RESTART'</simple> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" /> + <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" /> + <to uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" /> + </when> + </choice> + </route> + +</routes>
\ No newline at end of file diff --git a/src/test/resources/clds/templates/dcae-decode-service_ids.json b/src/test/resources/clds/templates/dcae-decode-service_ids.json deleted file mode 100644 index 619cac67a..000000000 --- a/src/test/resources/clds/templates/dcae-decode-service_ids.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "vUSP": [ - "vUSP - vCTS" - ], - "Trinity": [ - "ASBGv TLS VNF", - "ASBGv No TLS", - "ASBGv (NO TLS) VNF", - "ASBGv TLS", - "NSBGv VNF", - "NSBGv" - ], - "vSCP": [ - "AKRON_vSCP_F5_FW-SVC/vSCP_F5_FW 1", - "ALLEN_vSCP_F5_FW-SVC/vSCP_F5_FW 1" - ], - "vProbes": [ - "vProbes - FW" - ] -} diff --git a/src/test/resources/clds/templates/ui-alarm-default.json b/src/test/resources/clds/templates/ui-alarm-default.json deleted file mode 100644 index c851e6cdd..000000000 --- a/src/test/resources/clds/templates/ui-alarm-default.json +++ /dev/null @@ -1,597 +0,0 @@ -{ - "Reports a transient alarm condition when an incoming CDR cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming CDR cannot be decoded successfully", - "Reports a transient alarm condition when an incoming ACR message cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming ACR message cannot be decoded successfully", - "Reports a transient alarm condition when a CDR validation fails": "vCCF: Reports a transient alarm condition when a CDR validation fails", - "Reports a transient alarm condition when an incoming GTP' message cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming GTP' message cannot be decoded successfully", - "Reports a transient alarm condition when an incoming CDR file cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming CDR file cannot be decoded successfully", - "Reports a transient alarm condition when an incoming Sh/Dh file cannot be decoded successfully": "vCCF: Reports a transient alarm condition when an incoming Sh/Dh file cannot be decoded successfully", - "Reports a transient alarm condition when an incoming ACR message is in conflict with former ACR in one diameter session": "vCCF: Reports a transient alarm condition when an incoming ACR message is in conflict with former ACR in one diameter session", - "Reports a transient alarm condition when an outgoing Ro message send fails": "vCCF: Reports a transient alarm condition when an outgoing Ro message send fails", - "Reports a transient alarm condition when an outgoing GTP' message send fails": "vCCF: Reports a transient alarm condition when an outgoing GTP' message send fails", - "Reports a transient alarm condition when an outgoing Sh/Dh message send fails": "vCCF: Reports a transient alarm condition when an outgoing Sh/Dh message send fails", - "Reports an alarm when build or send Rf message fail": "vCCF: Reports an alarm when build or send Rf message fail", - "Reports a transient alarm condition when an abnormal incoming CCA message": "vCCF: Reports a transient alarm condition when an abnormal incoming CCA message", - "Reports a transient alarm condition when there is an abnormal incoming Sh/Dh message": "vCCF: Reports a transient alarm condition when there is an abnormal incoming Sh/Dh message", - "For Rf interface, if IeCCF receives a message with incorrect value for session id.": "vCCF: For Rf interface, if IeCCF receives a message with incorrect value for session id.", - "Reports an alarm when CPU usage exceeds the major threshold, the local database exceeds the critical threshold, or the ACR partition exceeds the major threshold": "vCCF: Reports an alarm when CPU usage exceeds the major threshold, the local database exceeds the critical threshold, or the ACR partition exceeds the major threshold", - "Reports an alarm when CPU usage exceeds the minor threshold, the local database exceeds the major threshold, or the ACR partition exceeds the minor threshold": "vCCF: Reports an alarm when CPU usage exceeds the minor threshold, the local database exceeds the major threshold, or the ACR partition exceeds the minor threshold", - "Reports an alarm when CPU usage exceeds the critical threshold, the local database exceeds the major threshold, or the CDR partition exceeds the critical threshold": "vCCF: Reports an alarm when CPU usage exceeds the critical threshold, the local database exceeds the major threshold, or the CDR partition exceeds the critical threshold", - "Reports an alarm when CPU usage exceeds the major threshold or CDR partition exceeds the major threshold": "vCCF: Reports an alarm when CPU usage exceeds the major threshold or CDR partition exceeds the major threshold", - "Reports an alarm when external DB usage exceeds the major threshold": "vCCF: Reports an alarm when external DB usage exceeds the major threshold", - "Reports a transient alarm condition when the workflow definition table is provisioned wrongly": "vCCF: Reports a transient alarm condition when the workflow definition table is provisioned wrongly", - "Reports a transient alarm condition when the Action Definition table is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Action Definition table is provisioned wrongly", - "Reports a transient alarm condition when the Ro Host Configuration is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Ro Host Configuration is provisioned wrongly", - "Reports a transient alarm condition when the Sh Host Configuration is provisioned wrongly": "vCCF: Reports a transient alarm condition when the Sh Host Configuration is provisioned wrongly", - "Reports a transient alarm condition when a specific dictionary or rule does not exist": "vCCF: Reports a transient alarm condition when a specific dictionary or rule does not exist", - "Reports a transient alarm condition when failure occurs when mapping Rf message to XDR": "vCCF: Reports a transient alarm condition when failure occurs when mapping Rf message to XDR", - "Reports a transient alarm condition when failure occurs in aggregating process": "vCCF: Reports a transient alarm condition when failure occurs in aggregating process", - "Reports a transient alarm condition when failure happens in correlating process": "vCCF: Reports a transient alarm condition when failure happens in correlating process", - "Reports a transient alarm condition when failure occurs in generating CDR": "vCCF: Reports a transient alarm condition when failure occurs in generating CDR", - "Reports a transient alarm condition when failure occurs in constructing CCR message from XDR": "vCCF: Reports a transient alarm condition when failure occurs in constructing CCR message from XDR", - "Reports a transient alarm condition when an ACR/XER/BER/INC record write to bad file": "vCCF: Reports a transient alarm condition when an ACR/XER/BER/INC record write to bad file", - "Reports an alarm condition when aggregation or correlation central database connection is lost": "vCCF: Reports an alarm condition when aggregation or correlation central database connection is lost", - "Reports an alarm condition when a specific failure happens in database operations": "vCCF: Reports an alarm condition when a specific failure happens in database operations", - "Reports an alarm condition when DB capacity has been consumed to critical threshold": "vCCF: Reports an alarm condition when DB capacity has been consumed to critical threshold", - "Reports an alarm condition when DB capacity has been consumed to major threshold": "vCCF: Reports an alarm condition when DB capacity has been consumed to major threshold", - "Reports an alarm condition when DB capacity has been consumed to minor threshold.": "vCCF: Reports an alarm condition when DB capacity has been consumed to minor threshold.", - "Reports an alarm condition when application cannot deliver CDR to CDRSCH subsystem": "vCCF: Reports an alarm condition when application cannot deliver CDR to CDRSCH subsystem", - "Reports an alarm condition when some fields of ACR file header have error value and this ACR file cannot be processed further": "vCCF: Reports an alarm condition when some fields of ACR file header have error value and this ACR file cannot be processed further", - "Reports an alarm condition when some fields of ACR file header have invalid value and this ACR file can be processed further": "vCCF: Reports an alarm condition when some fields of ACR file header have invalid value and this ACR file can be processed further", - "Reports an alarm condition when the ACR file loses some ACR records": "vCCF: Reports an alarm condition when the ACR file loses some ACR records", - "Reports an alarm condition when some fields of ACR record header have error value and this ACR record and the following ACR records cannot be processed further": "vCCF: Reports an alarm condition when some fields of ACR record header have error value and this ACR record and the following ACR records cannot be processed further", - "Reports an alarm condition when error occurs in processing CDR/ACR files": "vCCF: Reports an alarm condition when error occurs in processing CDR/ACR files", - "Reports an alarm condition when CDR partition has been consumed to critical threshold": "vCCF: Reports an alarm condition when CDR partition has been consumed to critical threshold", - "Reports an alarm condition when CDR partition has been consumed to major threshold.": "vCCF: Reports an alarm condition when CDR partition has been consumed to major threshold.", - "Reports an alarm condition when CDR partition has been consumed to minor threshold": "vCCF: Reports an alarm condition when CDR partition has been consumed to minor threshold", - "Reports an alarm condition when ACR partition has been consumed to critical threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to critical threshold", - "Reports an alarm condition when ACR partition has been consumed to major threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to major threshold", - "Reports an alarm condition when ACR partition has been consumed to minor threshold": "vCCF: Reports an alarm condition when ACR partition has been consumed to minor threshold", - "Reports an alarm condition when CPU consumption reaches critical threshold": "vCCF: Reports an alarm condition when CPU consumption reaches critical threshold", - "Reports an alarm condition when CPU consumption reaches major threshold": "vCCF: Reports an alarm condition when CPU consumption reaches major threshold", - "Reports an alarm condition when CPU consumption reaches minor threshold": "vCCF: Reports an alarm condition when CPU consumption reaches minor threshold", - "Service shall monitor * number of partial CDR * number of incompleted CDR * number of unacceptable CDR If any one exceeds a configurable threshold in a configrable interval.": "vCCF: Service shall monitor * number of partial CDR * number of incompleted CDR * number of unacceptable CDR If any one exceeds a configurable threshold in a configrable interval.", - "CDR size exceed the platform capacity.": "vCCF: CDR size exceed the platform capacity.", - "Service shall monitor number of ACR without AII AVP, If it exceeds a configurable threshold in a configurable interval.": "vCCF: Service shall monitor number of ACR without AII AVP, If it exceeds a configurable threshold in a configurable interval.", - "Service shall monitor CDR cut due to ECCF_ACRNUMBER_IN_DB, If it exceeds a configurable threshold in a configurable interval.": "vCCF: Service shall monitor CDR cut due to ECCF_ACRNUMBER_IN_DB, If it exceeds a configurable threshold in a configurable interval.", - "External Node of this Cluster is overload": "vCCF: External Node of this Cluster is overload", - "bdb_high_latency": "vCCF-vDB: bdb_high_latency", - "bdb_high_throughput": "vCCF-vDB: bdb_high_throughput", - "bdb_size": "vCCF-vDB: bdb_size", - "cluster_inconsistent_rl_sw": "vCCF-vDB: cluster_inconsistent_rl_sw", - "cluster_node_remove_abort_failed": "vCCF-vDB: cluster_node_remove_abort_failed", - "cluster_node_remove_failed": "vCCF-vDB: cluster_node_remove_failed", - "cluster_ram_overcommit": "vCCF-vDB: cluster_ram_overcommit", - "cluster_rebalance_failed": "vCCF-vDB: cluster_rebalance_failed", - "cluster_too_few_nodes_for_replication": "vCCF-vDB: cluster_too_few_nodes_for_replication", - "node_cpu_utilization": "vCCF-vDB: node_cpu_utilization", - "node_ephemeral_storage": "vCCF-vDB: node_ephemeral_storage", - "node_failed": "vCCF-vDB: node_failed", - "node_memory": "vCCF-vDB: node_memory", - "node_net_throughput": "vCCF-vDB: node_net_throughput", - "node_offline_failed": "vCCF-vDB: node_offline_failed", - "node_offline_abort_failed": "vCCF-vDB: node_offline_abort_failed", - "node_online_failed": "vCCF-vDB: node_online_failed", - "OAM NODE-<OAME-hostname> IS NOT ACTIVE ": "vCCF-vDB: OAM NODE-<OAME-hostname> IS NOT ACTIVE ", - "LSS_asdaCommunicationFailure": "vCTS: LSS_asdaCommunicationFailure", - "LSS_ccdbCommunicationFailure": "vCTS: LSS_ccdbCommunicationFailure", - "LSS_cpiCTS3xxFailRate": "vCTS: LSS_cpiCTS3xxFailRate", - "LSS_cpiCTS4xxFailRate": "vCTS: LSS_cpiCTS4xxFailRate", - "LSS_cpiCTS5xxFailRate": "vCTS: LSS_cpiCTS5xxFailRate", - "LSS_cpiCTS6xxFailRate": "vCTS: LSS_cpiCTS6xxFailRate", - "LSS_cpiCTSSIPRetransmitInvite": "vCTS: LSS_cpiCTSSIPRetransmitInvite", - "LSS_cpiCTSSIPRetransmitNonInvite": "vCTS: LSS_cpiCTSSIPRetransmitNonInvite", - "LSS_glsInvalidCellId": "vCTS: LSS_glsInvalidCellId", - "LSS_glsServerUnavailable": "vCTS: LSS_glsServerUnavailable", - "LSS_hlrSyncConnection": "vCTS: LSS_hlrSyncConnection", - "LSS_hlrSyncQueue": "vCTS: LSS_hlrSyncQueue", - "LSS_lispBufferFullExternalLIG": "vCTS: LSS_lispBufferFullExternalLIG", - "LSS_prdbConnectWithAlternateFailure": "vCTS: LSS_prdbConnectWithAlternateFailure", - "LSS_prdbSyncDataToAlternateFailure": "vCTS: LSS_prdbSyncDataToAlternateFailure", - "LSS_preAllocatedResourceOverload": "vCTS: LSS_preAllocatedResourceOverload", - "LSS_prifSocketError": "vCTS: LSS_prifSocketError", - "LSS_prsCallInstanceExceeded": "vCTS: LSS_prsCallInstanceExceeded", - "LSS_prsCpuOverload": "vCTS: LSS_prsCpuOverload", - "LSS_prsDatabaseMigrationFailure": "vCTS: LSS_prsDatabaseMigrationFailure", - "LSS_prsFailureToConnectWithPRDB": "vCTS: LSS_prsFailureToConnectWithPRDB", - "LSS_prsQueueExceeded": "vCTS: LSS_prsQueueExceeded", - "LSS_smdiSocketError": "vCTS: LSS_smdiSocketError", - "LSS_socketError": "vCTS: LSS_socketError", - "LSS_softwareComponentDown": "vCTS: LSS_softwareComponentDown", - "LSS_tlsInitError": "vCTS: LSS_tlsInitError", - "LSS_usageOfSyncTable": "vCTS: LSS_usageOfSyncTable", - "LSS_utHttpProxyConnectionDown ": "vCTS: LSS_utHttpProxyConnectionDown ", - "LSS_wpifSocketError": "vCTS: LSS_wpifSocketError", - "LSS_acrTemporaryBufferOverload": "vCTS: LSS_acrTemporaryBufferOverload", - "LSS_adnsExtendedTTLcaching": "vCTS: LSS_adnsExtendedTTLcaching", - "LSS_adnsQueryFailureCaching": "vCTS: LSS_adnsQueryFailureCaching", - "LSS_adnsQueueCongestion": "vCTS: LSS_adnsQueueCongestion", - "LSS_asdaRequestQueue": "vCTS: LSS_asdaRequestQueue", - "LSS_capacityLicenseKeyExpiration": "vCTS: LSS_capacityLicenseKeyExpiration", - "LSS_capacityLicenseKeyNearExpiration": "vCTS: LSS_capacityLicenseKeyNearExpiration", - "LSS_capacityLicenseKeyValidationError": "vCTS: LSS_capacityLicenseKeyValidationError", - "LSS_cardConnectionLost": "vCTS: LSS_cardConnectionLost", - "LSS_cpiAlrmCritical": "vCTS: LSS_cpiAlrmCritical", - "LSS_cpiAlrmMajor": "vCTS: LSS_cpiAlrmMajor", - "LSS_cpiAlrmMinor": "vCTS: LSS_cpiAlrmMinor", - "LSS_cpiAlrmWarning": "vCTS: LSS_cpiAlrmWarning", - "LSS_cpiAsrtEsc": "vCTS: LSS_cpiAsrtEsc", - "LSS_cpiAsrtNonEsc": "vCTS: LSS_cpiAsrtNonEsc", - "LSS_cpiAsrtNonEscCritical": "vCTS: LSS_cpiAsrtNonEscCritical", - "LSS_cpiAsrtNonEscMajor": "vCTS: LSS_cpiAsrtNonEscMajor", - "LSS_cpiAsrtNonEscMinor": "vCTS: LSS_cpiAsrtNonEscMinor", - "LSS_cpiAudErrCount": "vCTS: LSS_cpiAudErrCount", - "LSS_cpiAudManAct": "vCTS: LSS_cpiAudManAct", - "LSS_cpiAudNewEvent": "vCTS: LSS_cpiAudNewEvent", - "LSS_cpiCompleteRateAlarm": "vCTS: LSS_cpiCompleteRateAlarm", - "LSS_cpiDropMGAllocConnReq": "vCTS: LSS_cpiDropMGAllocConnReq", - "LSS_cpiDropRateAlarm": "vCTS: LSS_cpiDropRateAlarm", - "LSS_cpiExceptionService": "vCTS: LSS_cpiExceptionService", - "LSS_cpiFailRateAlarm": "vCTS: LSS_cpiFailRateAlarm", - "LSS_cpiFailSCTPFastRetransIncr": "vCTS: LSS_cpiFailSCTPFastRetransIncr", - "LSS_cpiFailSCTPFastRetransRate": "vCTS: LSS_cpiFailSCTPFastRetransRate", - "LSS_cpiFailSCTPSRTT1Incr": "vCTS: LSS_cpiFailSCTPSRTT1Incr", - "LSS_cpiFailSCTPSRTT2Incr": "vCTS: LSS_cpiFailSCTPSRTT2Incr", - "LSS_cpiFailSCTPT3RetransIncr": "vCTS: LSS_cpiFailSCTPT3RetransIncr", - "LSS_cpiFailSCTPT3RetransRate": "vCTS: LSS_cpiFailSCTPT3RetransRate", - "LSS_cpiFileSysUsage": "vCTS: LSS_cpiFileSysUsage", - "LSS_cpiMemAllocFail": "vCTS: LSS_cpiMemAllocFail", - "LSS_cpiNumOfLICDRDel": "vCTS: LSS_cpiNumOfLICDRDel", - "LSS_cpiReinitServiceSelf": "vCTS: LSS_cpiReinitServiceSelf", - "LSS_cpiSIPRetransmitInvite": "vCTS: LSS_cpiSIPRetransmitInvite", - "LSS_cpiSIPRetransmitNonInvite": "vCTS: LSS_cpiSIPRetransmitNonInvite", - "LSS_cpiSS7DropSCTPPktsRcvd": "vCTS: LSS_cpiSS7DropSCTPPktsRcvd", - "LSS_cpiSS7FailSCTPFastRetransRate": "vCTS: LSS_cpiSS7FailSCTPFastRetransRate", - "LSS_cpiStabilityAlarm": "vCTS: LSS_cpiStabilityAlarm", - "LSS_cpuOverload": "vCTS: LSS_cpuOverload", - "LSS_databaseConnectionLost": "vCTS: LSS_databaseConnectionLost", - "LSS_databaseReplicationLinkDown": "vCTS: LSS_databaseReplicationLinkDown", - "LSS_databaseSizeExhausted": "vCTS: LSS_databaseSizeExhausted", - "LSS_dbHighCpuUtilization": "vCTS: LSS_dbHighCpuUtilization", - "LSS_dbOffline": "vCTS: LSS_dbOffline", - "LSS_dbStatusUnexpected": "vCTS: LSS_dbStatusUnexpected", - "LSS_degradedResource": "vCTS: LSS_degradedResource", - "LSS_degrow": "vCTS: LSS_degrow", - "LSS_deviceServerCxnLost": "vCTS: LSS_deviceServerCxnLost", - "LSS_diamLinkDown": "vCTS: LSS_diamLinkDown", - "LSS_diamMaxClientsExceeded": "vCTS: LSS_diamMaxClientsExceeded", - "LSS_dnsThreshold": "vCTS: LSS_dnsThreshold", - "LSS_ethernetError": "vCTS: LSS_ethernetError", - "LSS_ethernetLinkDown": "vCTS: LSS_ethernetLinkDown", - "LSS_externalConnectivity": "vCTS: LSS_externalConnectivity", - "LSS_featureLicenseExpiration": "vCTS: LSS_featureLicenseExpiration", - "LSS_featureLicenseKeyNearExpiration": "vCTS: LSS_featureLicenseKeyNearExpiration", - "LSS_featureLockValidationError": "vCTS: LSS_featureLockValidationError", - "LSS_fqdnError": "vCTS: LSS_fqdnError", - "LSS_fru": "vCTS: LSS_fru", - "LSS_gatewayCongestion": "vCTS: LSS_gatewayCongestion", - "LSS_gatewayForcedOOS": "vCTS: LSS_gatewayForcedOOS", - "LSS_gatewayProvisioningError": "vCTS: LSS_gatewayProvisioningError", - "LSS_gatewayUnreachable": "vCTS: LSS_gatewayUnreachable", - "LSS_gatewayUnregistered": "vCTS: LSS_gatewayUnregistered", - "LSS_globalParameterNotFound": "vCTS: LSS_globalParameterNotFound", - "LSS_grow": "vCTS: LSS_grow", - "LSS_h248MessageBufferDepletion": "vCTS: LSS_h248MessageBufferDepletion", - "LSS_hostDown": "vCTS: LSS_hostDown", - "LSS_hostReset": "vCTS: LSS_hostReset", - "LSS_invalidGateway": "vCTS: LSS_invalidGateway", - "LSS_iriLinkDown": "vCTS: LSS_iriLinkDown", - "LSS_ldapServerConnectionLost": "vCTS: LSS_ldapServerConnectionLost", - "LSS_llcDown": "vCTS: LSS_llcDown", - "LSS_logicalLinkDown": "vCTS: LSS_logicalLinkDown", - "LSS_logicalLinkNotFound": "vCTS: LSS_logicalLinkNotFound", - "LSS_logRotateThreshold": "vCTS: LSS_logRotateThreshold", - "LSS_memoryOverload": "vCTS: LSS_memoryOverload", - "LSS_nodeConfigFailure": "vCTS: LSS_nodeConfigFailure", - "LSS_nodeGroupOOS": "vCTS: LSS_nodeGroupOOS", - "LSS_nodeOOS": "vCTS: LSS_nodeOOS", - "LSS_nonCompliantFaultGroupMemberState": "vCTS: LSS_nonCompliantFaultGroupMemberState", - "LSS_nonCsAddrChannelDepletion": "vCTS: LSS_nonCsAddrChannelDepletion", - "LSS_numberOfTuplesInUse": "vCTS: LSS_numberOfTuplesInUse", - "LSS_osSecInfoModificationDetected": "vCTS: LSS_osSecInfoModificationDetected", - "LSS_osSecInformationMissing": "vCTS: LSS_osSecInformationMissing", - "LSS_osSecUnexpectedInformation": "vCTS: LSS_osSecUnexpectedInformation", - "LSS_pdnsMySqlReplication": "vCTS: LSS_pdnsMySqlReplication", - "LSS_pktCorruptionDetectedViaRCCLANCheck": "vCTS: LSS_pktCorruptionDetectedViaRCCLANCheck", - "LSS_platformCommandFailure": "vCTS: LSS_platformCommandFailure", - "LSS_pmDataNotCollected": "vCTS: LSS_pmDataNotCollected", - "LSS_processDown": "vCTS: LSS_processDown", - "LSS_processNotStarted": "vCTS: LSS_processNotStarted", - "LSS_provisioningInhibitedMode": "vCTS: LSS_provisioningInhibitedMode", - "LSS_rccInhibitedMode": "vCTS: LSS_rccInhibitedMode", - "LSS_remotedbLinkDown": "vCTS: LSS_remotedbLinkDown", - "LSS_remoteQueryServerFailure": "vCTS: LSS_remoteQueryServerFailure", - "LSS_restore": "vCTS: LSS_restore", - "LSS_serviceCFGDataTimestampError": "vCTS: LSS_serviceCFGDataTimestampError", - "LSS_serviceCommCxnLost": "vCTS: LSS_serviceCommCxnLost", - "LSS_serviceOnewayCommunication": "vCTS: LSS_serviceOnewayCommunication", - "LSS_sheddingOverload": "vCTS: LSS_sheddingOverload", - "LSS_simxml": "vCTS: LSS_simxml", - "LSS_sipLinkSetMaxQuarantineList": "vCTS: LSS_sipLinkSetMaxQuarantineList", - "LSS_sipLinkSetUnavailable": "vCTS: LSS_sipLinkSetUnavailable", - "LSS_sipLinkUnavailable": "vCTS: LSS_sipLinkUnavailable", - "LSS_softwareAllocatedResourceOverload": "vCTS: LSS_softwareAllocatedResourceOverload", - "LSS_softwareComponentStandbyNotReady": "vCTS: LSS_softwareComponentStandbyNotReady", - "LSS_softwareLicense": "vCTS: LSS_softwareLicense", - "LSS_svcdegrow": "vCTS: LSS_svcdegrow", - "LSS_svcgrow": "vCTS: LSS_svcgrow", - "LSS_swVersionMismatch": "vCTS: LSS_swVersionMismatch", - "LSS_tftpDownloadCorrupt": "vCTS: LSS_tftpDownloadCorrupt", - "LSS_timeStampValueOutOfSystemRange": "vCTS: LSS_timeStampValueOutOfSystemRange", - "LSS_transactionHandlerBlockDepletion": "vCTS: LSS_transactionHandlerBlockDepletion", - "LSS_upgrade": "vCTS: LSS_upgrade", - "SYS_BackupFailure": "vCTS: SYS_BackupFailure", - "SYS_Configuration": "vCTS: SYS_Configuration", - "SYS_COTRecordTransferFailure": "vCTS: SYS_COTRecordTransferFailure", - "SYS_CPM_USERDATA_INCONSITENCY": "vCTS: SYS_CPM_USERDATA_INCONSITENCY", - "SYS_CPM_USERDATA_RESTORED": "vCTS: SYS_CPM_USERDATA_RESTORED", - "SYS_EventQueueCapacity": "vCTS: SYS_EventQueueCapacity", - "SYS_ICMPFailure": "vCTS: SYS_ICMPFailure", - "SYS_IPsecConfig": "vCTS: SYS_IPsecConfig", - "SYS_LinkDown": "vCTS: SYS_LinkDown", - "SYS_NotifyDisabled": "vCTS: SYS_NotifyDisabled", - "SYS_NotifyLocked": "vCTS: SYS_NotifyLocked", - "SYS_NumTL1MeasThresh": "vCTS: SYS_NumTL1MeasThresh", - "SYS_RADIUS_TO_LDAP_FAILURE": "vCTS: SYS_RADIUS_TO_LDAP_FAILURE", - "SYS_ROOT_ACCESS_DENIED": "vCTS: SYS_ROOT_ACCESS_DENIED", - "SYS_ROOT_FTP_VIOLATION": "vCTS: SYS_ROOT_FTP_VIOLATION", - "SYS_ROOT_LOGIN_VIOLATION": "vCTS: SYS_ROOT_LOGIN_VIOLATION", - "SYS_ROOT_SSH_LOGIN_VIOLATION": "vCTS: SYS_ROOT_SSH_LOGIN_VIOLATION", - "SYS_SetupAAAFailure": "vCTS: SYS_SetupAAAFailure", - "SYS_SNETrapOverload": "vCTS: SYS_SNETrapOverload", - "SYS_SNMPAuthenticationFailure": "vCTS: SYS_SNMPAuthenticationFailure", - "SYS_SNMPFailure": "vCTS: SYS_SNMPFailure", - "SYS_SU_TO_ROOT_FAILURE": "vCTS: SYS_SU_TO_ROOT_FAILURE", - "SYS_SYSTEMTrapOverload": "vCTS: SYS_SYSTEMTrapOverload", - "SYS_ThresholdCrossed": "vCTS: SYS_ThresholdCrossed", - "SYS_UndiscoveredObject": "vCTS: SYS_UndiscoveredObject", - "SYS_WriteAAAFailure": "vCTS: SYS_WriteAAAFailure", - "jnxSpaceDiskUsageRising": "vDBE-EMS-Juniper: jnxSpaceDiskUsageRising", - "jnxSpaceDiskUsageRisingCleared": "vDBE-EMS-Juniper: jnxSpaceDiskUsageRisingCleared", - "jnxSpaceSwapUsageRising": "vDBE-EMS-Juniper: jnxSpaceSwapUsageRising", - "jnxSpaceSwapUsageRisingCleared": "vDBE-EMS-Juniper: jnxSpaceSwapUsageRisingCleared", - "jnxSpaceCPULARising": "vDBE-EMS-Juniper: jnxSpaceCPULARising", - "jnxSpaceCPULARisingCleared": "vDBE-EMS-Juniper: jnxSpaceCPULARisingCleared", - "jnxSpaceWebpProxyProcessDown": "vDBE-EMS-Juniper: jnxSpaceWebpProxyProcessDown", - "jnxSpaceWebpProxyProcessUp": "vDBE-EMS-Juniper: jnxSpaceWebpProxyProcessUp", - "jnxSpaceNMAProcessDown": "vDBE-EMS-Juniper: jnxSpaceNMAProcessDown", - "jnxSpaceNMAProcessUp": "vDBE-EMS-Juniper: jnxSpaceNMAProcessUp", - "jnxSpaceJbossProcessDown": "vDBE-EMS-Juniper: jnxSpaceJbossProcessDown", - "jnxSpaceJbossProcessUp": "vDBE-EMS-Juniper: jnxSpaceJbossProcessUp", - "jnxSpaceMysqlProcessDown": "vDBE-EMS-Juniper: jnxSpaceMysqlProcessDown", - "jnxSpaceMysqlProcessUp": "vDBE-EMS-Juniper: jnxSpaceMysqlProcessUp", - "jnxSpacePostgresqlProcessDown": "vDBE-EMS-Juniper: jnxSpacePostgresqlProcessDown", - "jnxSpacePostgresqlProcessUp": "vDBE-EMS-Juniper: jnxSpacePostgresqlProcessUp", - "jnxSpaceWatchdogStopped": "vDBE-EMS-Juniper: jnxSpaceWatchdogStopped", - "jnxSpaceWatchdogStarted": "vDBE-EMS-Juniper: jnxSpaceWatchdogStarted", - "jnxSpaceSNAProcessDown": "vDBE-EMS-Juniper: jnxSpaceSNAProcessDown", - "jnxSpaceSNAProcessUp": "vDBE-EMS-Juniper: jnxSpaceSNAProcessUp", - "jnxSpaceNodeDown": "vDBE-EMS-Juniper: jnxSpaceNodeDown", - "jnxSpaceNodeUp": "vDBE-EMS-Juniper: jnxSpaceNodeUp", - "jnxSpaceNodeRemoval": "vDBE-EMS-Juniper: jnxSpaceNodeRemoval", - "jnxCmCfgChange": "vDBE-Juniper: jnxCmCfgChange", - "jnxCmRescueChange": "vDBE-Juniper: jnxCmRescueChange", - "jnxEventTrap": "vDBE-Juniper: jnxEventTrap", - "jnxJsFwAuthFailure": "vDBE-Juniper: jnxJsFwAuthFailure", - "jnxJsFwAuthServiceUp": "vDBE-Juniper: jnxJsFwAuthServiceUp", - "jnxJsFwAuthServiceDown": "vDBE-Juniper: jnxJsFwAuthServiceDown", - "jnxJsFwAuthCapacityExceeded": "vDBE-Juniper: jnxJsFwAuthCapacityExceeded", - "jnxJsIdpSignatureUpdate": "vDBE-Juniper: jnxJsIdpSignatureUpdate", - "jnxJsIdpAttackLog": "vDBE-Juniper: jnxJsIdpAttackLog", - "jnxJsSrcNatPoolThresholdStatus": "vDBE-Juniper: jnxJsSrcNatPoolThresholdStatus", - "jnxJsNatRuleThresholdStatus": "vDBE-Juniper: jnxJsNatRuleThresholdStatus", - "jnxJsScreenAttack": "vDBE-Juniper: jnxJsScreenAttack", - "jnxJsScreenCfgChange": "vDBE-Juniper: jnxJsScreenCfgChange", - "jnxJsAvPatternUpdateTrap": "vDBE-Juniper: jnxJsAvPatternUpdateTrap", - "jnxJsChassisClusterSwitchover": "vDBE-Juniper: jnxJsChassisClusterSwitchover", - "jnxJsChClusterIntfTrap": "vDBE-Juniper: jnxJsChClusterIntfTrap", - "jnxJsChClusterSpuMismatchTrap": "vDBE-Juniper: jnxJsChClusterSpuMismatchTrap", - "jnxJsChClusterWeightTrap": "vDBE-Juniper: jnxJsChClusterWeightTrap", - "jnxLicenseGraceExpired": "vDBE-Juniper: jnxLicenseGraceExpired", - "jnxLicenseGraceAboutToExpire": "vDBE-Juniper: jnxLicenseGraceAboutToExpire", - "jnxLicenseAboutToExpire": "vDBE-Juniper: jnxLicenseAboutToExpire", - "jnxLicenseInfringeCumulative": "vDBE-Juniper: jnxLicenseInfringeCumulative", - "jnxLicenseInfringeSingle": "vDBE-Juniper: jnxLicenseInfringeSingle", - "jnxNatAddrPoolThresholdStatus": "vDBE-Juniper: jnxNatAddrPoolThresholdStatus", - "jnxSyslogTrap": "vDBE-Juniper: jnxSyslogTrap", - "jnxAccessAuthServiceUp": "vDBE-Juniper: jnxAccessAuthServiceUp", - "jnxAccessAuthServiceDown": "vDBE-Juniper: jnxAccessAuthServiceDown", - "jnxAccessAuthServerDisabled": "vDBE-Juniper: jnxAccessAuthServerDisabled", - "jnxAccessAuthServerEnabled": "vDBE-Juniper: jnxAccessAuthServerEnabled", - "jnxAccessAuthAddressPoolHighThreshold": "vDBE-Juniper: jnxAccessAuthAddressPoolHighThreshold", - "jnxAccessAuthAddressPoolAbateThreshold": "vDBE-Juniper: jnxAccessAuthAddressPoolAbateThreshold", - "jnxAccessAuthAddressPoolOutOfAddresses": "vDBE-Juniper: jnxAccessAuthAddressPoolOutOfAddresses", - "jnxAccessAuthAddressPoolOutOfMemory": "vDBE-Juniper: jnxAccessAuthAddressPoolOutOfMemory", - "LEVEL_WARNING_CPU": "vMRF: LEVEL_WARNING_CPU", - "LEVEL_MAJOR_CPU": "vMRF: LEVEL_MAJOR_CPU", - "LEVEL_CRITICAL_CPU": "vMRF: LEVEL_CRITICAL_CPU", - "LEVEL_WARNING_MEM": "vMRF: LEVEL_WARNING_MEM", - "LEVEL_MAJOR_MEM": "vMRF: LEVEL_MAJOR_MEM", - "LEVEL_CRITICAL_MEM": "vMRF: LEVEL_CRITICAL_MEM", - "LEVEL_WARNING_DISK": "vMRF: LEVEL_WARNING_DISK", - "LEVEL_MAJOR_DISK": "vMRF: LEVEL_MAJOR_DISK", - "LEVEL_CRITICAL_DISK": "vMRF: LEVEL_CRITICAL_DISK", - "LEVEL_WARNING_RTPBANDWIDTH": "vMRF: LEVEL_WARNING_RTPBANDWIDTH", - "LEVEL_MAJOR_RTPBANDWIDTH": "vMRF: LEVEL_MAJOR_RTPBANDWIDTH", - "LEVEL_CRITICAL_RTPBANDWIDTH": "vMRF: LEVEL_CRITICAL_RTPBANDWIDTH", - "LEVEL_WARNING_RTPINPACKETLOSS": "vMRF: LEVEL_WARNING_RTPINPACKETLOSS", - "LEVEL_MAJOR_RTPINPACKETLOSS": "vMRF: LEVEL_MAJOR_RTPINPACKETLOSS", - "LEVEL_CRITICAL_RTPINPACKETLOSS": "vMRF: LEVEL_CRITICAL_RTPINPACKETLOSS", - "LEVEL_WARNING_RTPOUTPACKETLOSS": "vMRF: LEVEL_WARNING_RTPOUTPACKETLOSS", - "LEVEL_MAJOR_RTPOUTPACKETLOSS": "vMRF: LEVEL_MAJOR_RTPOUTPACKETLOSS", - "LEVEL_CRITICAL_RTPOUTPACKETLOSS": "vMRF: LEVEL_CRITICAL_RTPOUTPACKETLOSS", - "LEVEL_WARNING_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_WARNING_TCPLOSTRETRANSMITRATE", - "LEVEL_MAJOR_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_MAJOR_TCPLOSTRETRANSMITRATE", - "LEVEL_CRITICAL_TCPLOSTRETRANSMITRATE": "vMRF: LEVEL_CRITICAL_TCPLOSTRETRANSMITRATE", - "LEVEL_WARNING_TCPLOSSFAILURERATE": "vMRF: LEVEL_WARNING_TCPLOSSFAILURERATE", - "LEVEL_MAJOR_TCPLOSSFAILURERATE": "vMRF: LEVEL_MAJOR_TCPLOSSFAILURERATE", - "LEVEL_CRITICAL_TCPLOSSFAILURERATE": "vMRF: LEVEL_CRITICAL_TCPLOSSFAILURERATE", - "LEVEL_CRITICAL_RTPLINKDOWN": "vMRF: LEVEL_CRITICAL_RTPLINKDOWN", - "TARGET_REACHABLE": "vMRF: TARGET_REACHABLE", - "PUBLICATION_ERROR": "vMRF: PUBLICATION_ERROR", - "REMOTE_SERVER_SYNCHRONIZATION_ERROR": "vMRF: REMOTE_SERVER_SYNCHRONIZATION_ERROR", - "TRANSCODER_TOOL_EXEC_ERROR": "vMRF: TRANSCODER_TOOL_EXEC_ERROR", - "CLIENT_SYNCHRONIZATION_ERROR": "vMRF: CLIENT_SYNCHRONIZATION_ERROR", - "CLUSTER_UNREACHABLE": "vMRF: CLUSTER_UNREACHABLE", - "REMOTE_NODE_OFFLINE": "vMRF: REMOTE_NODE_OFFLINE", - "IPADDR_STOPPED": "vMRF: IPADDR_STOPPED", - "MRFC_STOPPED": "vMRF: MRFC_STOPPED", - "MNGT_STOPPED": "vMRF: MNGT_STOPPED", - "IPADDR_STARTED": "vMRF: IPADDR_STARTED", - "MRFC_STARTED": "vMRF: MRFC_STARTED", - "MNGT_STARTED": "vMRF: MNGT_STARTED", - "VOLATTACH_FAILED": "vMRF: VOLATTACH_FAILED", - "VOLDETACH_FAILED": "vMRF: VOLDETACH_FAILED", - "VOLDEL": "vMRF: VOLDEL", - "VOLCORRUPT": "vMRF: VOLCORRUPT", - "VOLFOREIGN": "vMRF: VOLFOREIGN", - "ACTIVE_ALARM_TABLE_PURGE": "vMRF: ACTIVE_ALARM_TABLE_PURGE", - "GENERIC_FORMER_STATELESS": "vMRF: GENERIC_FORMER_STATELESS", - "GENERIC_FORMER_STATEFUL": "vMRF: GENERIC_FORMER_STATEFUL", - "NO_MORE_ALARM_DESCRIPTION": "vMRF: NO_MORE_ALARM_DESCRIPTION", - "SERVICE_PROCESS_ENDS": "vMRF: SERVICE_PROCESS_ENDS", - "DEFENSE_STOPPED": "vMRF: DEFENSE_STOPPED", - "USER_ACCOUNT_LOCKED": "vMRF: USER_ACCOUNT_LOCKED", - "CONNECTION_SQL_NOT_ESTABLISHED": "vMRF: CONNECTION_SQL_NOT_ESTABLISHED", - "FALSE_ALARM": "vMRF: FALSE_ALARM", - "RADIUS SERVER HS": "vMRF: RADIUS SERVER HS", - "DRM_PACKAGER_IS_NOT_AVAILABLE": "vMRF: DRM_PACKAGER_IS_NOT_AVAILABLE", - "DRM_LICENSE_BUILDER_IS_NOT_AVAILABLE": "vMRF: DRM_LICENSE_BUILDER_IS_NOT_AVAILABLE", - "ERROR_WHILE_CREATING_PLAYLIST_MANAGER_FILE": "vMRF: ERROR_WHILE_CREATING_PLAYLIST_MANAGER_FILE", - "ERROR_WHILE_BUILDING_PLAYLIST_XML_REPRESENTATION": "vMRF: ERROR_WHILE_BUILDING_PLAYLIST_XML_REPRESENTATION", - "PLAYLIST_FILE_TO_PUBLISH_NOT_FOUND": "vMRF: PLAYLIST_FILE_TO_PUBLISH_NOT_FOUND", - "COULD_NOT_CONNECT_TO_PVNS_SERVER": "vMRF: COULD_NOT_CONNECT_TO_PVNS_SERVER", - "HTTP_OR_HTTPCLIENT_EXCEPTION_HAS_OCCURRED": "vMRF: HTTP_OR_HTTPCLIENT_EXCEPTION_HAS_OCCURRED", - "I/O_ERROR_WHILE_PUBLISHING_PLAYLIST_FILE": "vMRF: I/O_ERROR_WHILE_PUBLISHING_PLAYLIST_FILE", - "ERROR_WHILE_REQUESTING_SDP_FILE": "vMRF: ERROR_WHILE_REQUESTING_SDP_FILE", - "ERROR_WHILE_REQUESTING_SDP_FILE:_REMOTE_EXCEPTION": "vMRF: ERROR_WHILE_REQUESTING_SDP_FILE:_REMOTE_EXCEPTION", - "NO_STREAMING_RESOURCES": "vMRF: NO_STREAMING_RESOURCES", - "NO_STREAMING_MODULES_REGISTERED": "vMRF: NO_STREAMING_MODULES_REGISTERED", - "SM_FAILURE": "vMRF: SM_FAILURE", - "MISSING_FILE_OR_ENCODER": "vMRF: MISSING_FILE_OR_ENCODER", - "INVALID_RANGE": "vMRF: INVALID_RANGE", - "THRESHOLD_VALUE_EXCEEDED": "vMRF: THRESHOLD_VALUE_EXCEEDED", - "TICKET_QUEUE_FULL": "vMRF: TICKET_QUEUE_FULL", - "PARSING_INITIALIZATION_EXCEPTION": "vMRF: PARSING_INITIALIZATION_EXCEPTION", - "CUSTOMERCARE_INTERNAL_EXCEPTION": "vMRF: CUSTOMERCARE_INTERNAL_EXCEPTION", - "PARSING_EXCEPTION": "vMRF: PARSING_EXCEPTION", - "I/O_PROBLEM": "vMRF: I/O_PROBLEM", - "INEXISTENT_FILE_OR_FOLDER": "vMRF: INEXISTENT_FILE_OR_FOLDER", - "FILE_NOT_IN_XML_FORMAT": "vMRF: FILE_NOT_IN_XML_FORMAT", - "SERVICE_STATE_CHANGE": "vMRF: SERVICE_STATE_CHANGE", - "MONITORED_FILE_UPDATE_ERROR": "vMRF: MONITORED_FILE_UPDATE_ERROR", - "MONITORED_RPM_DELETED_ERROR": "vMRF: MONITORED_RPM_DELETED_ERROR", - "MONITORED_RPM_ADDED_ERROR": "vMRF: MONITORED_RPM_ADDED_ERROR", - "MONITORED_CHMOD_ERROR": "vMRF: MONITORED_CHMOD_ERROR", - "MONITORED_CHOWN_ERROR": "vMRF: MONITORED_CHOWN_ERROR", - "PASSWD_ROOT_ERROR": "vMRF: PASSWD_ROOT_ERROR", - "PASSWD_ERROR": "vMRF: PASSWD_ERROR", - "ROOTKIT_ERROR": "vMRF: ROOTKIT_ERROR", - "STARTUP_ERR_UNDEFINED_PORT": "vMRF: STARTUP_ERR_UNDEFINED_PORT", - "STARTUP_ERR_FAIL_FIND_HOSTNAME": "vMRF: STARTUP_ERR_FAIL_FIND_HOSTNAME", - "STARTUP_ERR_CF_MISSING": "vMRF: STARTUP_ERR_CF_MISSING", - "STARTUP_ERR_FAILED_TO_OPEN_CF": "vMRF: STARTUP_ERR_FAILED_TO_OPEN_CF", - "STARTUP_ERR_FAILED_TO_BIND_PORT": "vMRF: STARTUP_ERR_FAILED_TO_BIND_PORT", - "STARTUP_ERR_CFG_UNIT_MISSING": "vMRF: STARTUP_ERR_CFG_UNIT_MISSING", - "MCTR_INVALID_CODEC_NAME": "vMRF: MCTR_INVALID_CODEC_NAME", - "RTSP_SERVER_FAILURE": "vMRF: RTSP_SERVER_FAILURE", - "RTSP_SERVER_QUARANTINE": "vMRF: RTSP_SERVER_QUARANTINE", - "TRANSCODING_FAILURE": "vMRF: TRANSCODING_FAILURE", - "FILE_CACHE_FAILURE": "vMRF: FILE_CACHE_FAILURE", - "STARTUP_ERROR_INITIALIZATION_FAILED": "vMRF: STARTUP_ERROR_INITIALIZATION_FAILED", - "CONFERENCE_FAILURE": "vMRF: CONFERENCE_FAILURE", - "PLC_DEGRADATION_LOW": "vMRF: PLC_DEGRADATION_LOW", - "PLC_DEGRADATION_MEDIUM": "vMRF: PLC_DEGRADATION_MEDIUM", - "PLC_DEGRADATION_HIGH": "vMRF: PLC_DEGRADATION_HIGH", - "AUDIO_RESYNCH_LOW": "vMRF: AUDIO_RESYNCH_LOW", - "AUDIO_RESYNCH_MEDIUM": "vMRF: AUDIO_RESYNCH_MEDIUM", - "AUDIO_RESYNCH_HIGH": "vMRF: AUDIO_RESYNCH_HIGH", - "VIDEO_RESYNCH_LOW": "vMRF: VIDEO_RESYNCH_LOW", - "VIDEO_RESYNCH_MEDIUM": "vMRF: VIDEO_RESYNCH_MEDIUM", - "VIDEO_RESYNCH_HIGH": "vMRF: VIDEO_RESYNCH_HIGH", - "PLAY_FAILURES_LOW": "vMRF: PLAY_FAILURES_LOW", - "PLAY_FAILURES_MEDIUM": "vMRF: PLAY_FAILURES_MEDIUM", - "PLAY_FAILURES_HIGH": "vMRF: PLAY_FAILURES_HIGH", - "NOT_ENOUGH_FREE_CONFEREE": "vMRF: NOT_ENOUGH_FREE_CONFEREE", - "NO_LONGER_FREE_CONFERENCE_ROOM": "vMRF: NO_LONGER_FREE_CONFERENCE_ROOM", - "STARTUP_ERROR_FAIL_TO_READ_CF": "vMRF: STARTUP_ERROR_FAIL_TO_READ_CF", - "STARTUP_ERROR_SIP_ADAPTER_INIT": "vMRF: STARTUP_ERROR_SIP_ADAPTER_INIT", - "STARTUP_ERROR_MONITORING_INIT": "vMRF: STARTUP_ERROR_MONITORING_INIT", - "REGISTER_ERROR_FAILURE": "vMRF: REGISTER_ERROR_FAILURE", - "DRI_ERROR_FAILURE": "vMRF: DRI_ERROR_FAILURE", - "STARTUP_ERROR_STACK_CONFIGURATION": "vMRF: STARTUP_ERROR_STACK_CONFIGURATION", - "STARTUP_ERROR_CONF": "vMRF: STARTUP_ERROR_CONF", - "STARTUP_ERROR_UNDEFINED_PORT": "vMRF: STARTUP_ERROR_UNDEFINED_PORT", - "HOST_REMOVED": "vMRF: HOST_REMOVED", - "INTERCEPT_THRESHOLD_NB_DIALOG_ALLOCATED": "vMRF: INTERCEPT_THRESHOLD_NB_DIALOG_ALLOCATED", - "STARTUP_ERROR_STACK_CONF": "vMRF: STARTUP_ERROR_STACK_CONF", - "STARTUP_ERROR_CONFIGURATION": "vMRF: STARTUP_ERROR_CONFIGURATION", - "STARTUP_ERROR_FAILED_TO_RETRIEVE_HOSTNAME": "vMRF: STARTUP_ERROR_FAILED_TO_RETRIEVE_HOSTNAME", - "LEVEL_WARNING_CALL": "vMRF: LEVEL_WARNING_CALL", - "LEVEL_ALARM_MINOR_CALL": "vMRF: LEVEL_ALARM_MINOR_CALL", - "LEVEL_ALARM_MAJOR_CALL": "vMRF: LEVEL_ALARM_MAJOR_CALL", - "LEVEL_ALARM_MRFPoutOfService": "vMRF: LEVEL_ALARM_MRFPoutOfService", - "MRFP_CALL_REJECTED_Threshold #1": "vMRF: MRFP_CALL_REJECTED_Threshold #1", - "MRFP_CALL_REJECTED_Threshold #2": "vMRF: MRFP_CALL_REJECTED_Threshold #2", - "MRFP_CALL_REJECTED_Threshold #3": "vMRF: MRFP_CALL_REJECTED_Threshold #3", - "MRFP_CALL_RETRIED_Threshold #1": "vMRF: MRFP_CALL_RETRIED_Threshold #1", - "MRFP_CALL_RETRIED_Threshold #2": "vMRF: MRFP_CALL_RETRIED_Threshold #2", - "MRFP_CALL_RETRIED_Threshold #3": "vMRF: MRFP_CALL_RETRIED_Threshold #3", - "STARTUP_PUB_FILE_NOT_PRESENT": "vMRF: STARTUP_PUB_FILE_NOT_PRESENT", - "STARTUP_INF_FILE_NOT_PRESENT": "vMRF: STARTUP_INF_FILE_NOT_PRESENT", - "STARTUP_LIC_FILE_NOT_PRESENT": "vMRF: STARTUP_LIC_FILE_NOT_PRESENT", - "GENERIC_HARDWARE_PROBLEM": "vMRF: GENERIC_HARDWARE_PROBLEM", - "HARD_DRIVE_PROBLEM": "vMRF: HARD_DRIVE_PROBLEM", - "NETWORK_LINK_PROBLEM": "vMRF: NETWORK_LINK_PROBLEM", - "POWER_SUPPLY_PROBLEM": "vMRF: POWER_SUPPLY_PROBLEM", - "SMART_HARD_DRIVE_PROBLEM": "vMRF: SMART_HARD_DRIVE_PROBLEM", - "STARTUP_ERROR": "vMRF: STARTUP_ERROR", - "RESOURCE_NOT_ACCESSIBLE": "vMRF: RESOURCE_NOT_ACCESSIBLE", - "RESOURCE_ACCESSIBLE": "vMRF: RESOURCE_ACCESSIBLE", - "RESOURCE_FULL": "vMRF: RESOURCE_FULL", - "DRI_ALARM": "vMRF: DRI_ALARM", - "REGISTER_ERROR_CCF": "vMRF: REGISTER_ERROR_CCF", - "REGISTER_ERROR_EXTERNAL": "vMRF: REGISTER_ERROR_EXTERNAL", - "TIMEOUT_ERROR": "vMRF: TIMEOUT_ERROR", - "VXML_ERROR": "vMRF: VXML_ERROR", - "A Network Element is no longer available due to a connection failure": "vMVM: A Network Element is no longer available due to a connection failure", - "A MetaSphere server is reporting a fault with the configuration of its connection to MetaView": "vMVM: A MetaSphere server is reporting a fault with the configuration of its connection to MetaView", - "Configured OBS IPs don't match available OBS nodes. Configured but unavailable nodes include: [<IP address>]. Real nodes not configured include: []": "vMVM: Configured OBS IPs don't match available OBS nodes. Configured but unavailable nodes include: [<IP address>]. Real nodes not configured include: []", - "Service Assurance Server <IP address> cannot be contacted": "vMVM: Service Assurance Server <IP address> cannot be contacted", - "The primary MetaView Director has lost contact with the backup MetaView Director": "vMVM: The primary MetaView Director has lost contact with the backup MetaView Director", - "The active server has lost connection to the standby": "vMVM: The active server has lost connection to the standby", - "CrashCounter": "vprobes-vBE-Processing: CrashCounter", - "IsAlive": "vprobes-vBE-Processing: IsAlive", - "SwRestart": "vprobes-vLB: SwRestart", - "Repeated exceptions have occurred.": "vSBC-Metaswitch: Repeated exceptions have occurred.", - "A licensing limit is close to capacity.": "vSBC-Metaswitch: A licensing limit is close to capacity.", - "One or more feature packs have been breached.": "vSBC-Metaswitch: One or more feature packs have been breached.", - "The grace period on this Perimeta system will expire in less than 48 hours, after which calls will not be processed.": "vSBC-Metaswitch: The grace period on this Perimeta system will expire in less than 48 hours, after which calls will not be processed.", - "The grace period on this Perimeta system will expire in less than 7 days, after which calls will not be processed.": "vSBC-Metaswitch: The grace period on this Perimeta system will expire in less than 7 days, after which calls will not be processed.", - "The license on this Perimeta system will expire in less than 4 weeks.": "vSBC-Metaswitch: The license on this Perimeta system will expire in less than 4 weeks.", - "A Perimeta blade has become unlicensed.": "vSBC-Metaswitch: A Perimeta blade has become unlicensed.", - "Perimeta is licensed with a bypass certificate, which is valid until the time displayed.": "vSBC-Metaswitch: Perimeta is licensed with a bypass certificate, which is valid until the time displayed.", - "The number of licensed instances exceeded a threshold of the licensed limit.": "vSBC-Metaswitch: The number of licensed instances exceeded a threshold of the licensed limit.", - "The software token on the primary Distributed Capacity Manager will expire on the displayed date.": "vSBC-Metaswitch: The software token on the primary Distributed Capacity Manager will expire on the displayed date.", - "A capacity limit on the license installed on this Perimeta system does not match the largest limit across all systems in the deployment.": "vSBC-Metaswitch: A capacity limit on the license installed on this Perimeta system does not match the largest limit across all systems in the deployment.", - "An adjacency has voice quality alerts.": "vSBC-Metaswitch: An adjacency has voice quality alerts.", - "The number of calls being audited is congested.": "vSBC-Metaswitch: The number of calls being audited is congested.", - "Session Controller is rejecting calls because there is no valid active call policy set configured.": "vSBC-Metaswitch: Session Controller is rejecting calls because there is no valid active call policy set configured.", - "A call policy set is inactive because it has been misconfigured.": "vSBC-Metaswitch: A call policy set is inactive because it has been misconfigured.", - "Session Controller is inactive and rejecting calls.": "vSBC-Metaswitch: Session Controller is inactive and rejecting calls.", - "Sources have breached minor or major blacklist thresholds.": "vSBC-Metaswitch: Sources have breached minor or major blacklist thresholds.", - "Sources are blacklisted.": "vSBC-Metaswitch: Sources are blacklisted.", - "The blacklisting configuration will change as a result of upgrade and some configured blacklists or alerts will no longer be applied.": "vSBC-Metaswitch: The blacklisting configuration will change as a result of upgrade and some configured blacklists or alerts will no longer be applied.", - "A large number of downgrades and bans have been created as a result of blacklisting.": "vSBC-Metaswitch: A large number of downgrades and bans have been created as a result of blacklisting.", - "Session Controller is unable to track further sources for blacklisting.": "vSBC-Metaswitch: Session Controller is unable to track further sources for blacklisting.", - "A software protection switch was triggered.": "vSBC-Metaswitch: A software protection switch was triggered.", - "A disk area on a processor blade is nearly full.": "vSBC-Metaswitch: A disk area on a processor blade is nearly full.", - "Memory use is very high.": "vSBC-Metaswitch: Memory use is very high.", - "The primary processor-blade has lost contact with the backup.": "vSBC-Metaswitch: The primary processor-blade has lost contact with the backup.", - "An efix or patch has been applied to this system containing diagnostic versions of some software libraries.": "vSBC-Metaswitch: An efix or patch has been applied to this system containing diagnostic versions of some software libraries.", - "A software protection switch (SPS) was triggered. Call and registration state was lost.": "vSBC-Metaswitch: A software protection switch (SPS) was triggered. Call and registration state was lost.", - "The Ethernet Heartbeat between primary and backup processors has failed.": "vSBC-Metaswitch: The Ethernet Heartbeat between primary and backup processors has failed.", - "The Backplane Heartbeat between primary and backup processors has failed.": "vSBC-Metaswitch: The Backplane Heartbeat between primary and backup processors has failed.", - "A disk area on a processor blade reported an error.": "vSBC-Metaswitch: A disk area on a processor blade reported an error.", - "The system is upgrading.": "vSBC-Metaswitch: The system is upgrading.", - "An error with NTP functionality has been detected.": "vSBC-Metaswitch: An error with NTP functionality has been detected.", - "One or more users are locked out of the system.": "vSBC-Metaswitch: One or more users are locked out of the system.", - "The Craft Terminal user FTP directory on a processor blade is nearly full.": "vSBC-Metaswitch: The Craft Terminal user FTP directory on a processor blade is nearly full.", - "A scheduled configuration snapshot has failed.": "vSBC-Metaswitch: A scheduled configuration snapshot has failed.", - "The Session Controller is stopping as a result of administrator action.": "vSBC-Metaswitch: The Session Controller is stopping as a result of administrator action.", - "A Session Controller processor blade is stopping as a result of administrator action.": "vSBC-Metaswitch: A Session Controller processor blade is stopping as a result of administrator action.", - "An object could not be activated because its service address does not exist or is not fully specified.": "vSBC-Metaswitch: An object could not be activated because its service address does not exist or is not fully specified.", - "The hardware on a processor does not meet minimum requirements.": "vSBC-Metaswitch: The hardware on a processor does not meet minimum requirements.", - "The hardware expectations of the two processors are not the same.": "vSBC-Metaswitch: The hardware expectations of the two processors are not the same.", - "The read speed of the main hard disk on a processor blade is too slow.": "vSBC-Metaswitch: The read speed of the main hard disk on a processor blade is too slow.", - "An error has occurred reading from the hard disk on a processor blade.": "vSBC-Metaswitch: An error has occurred reading from the hard disk on a processor blade.", - "Backup and primary processor-blades have an inconsistent system role.": "vSBC-Metaswitch: Backup and primary processor-blades have an inconsistent system role.", - "Event: The system encountered a critical error and had to restart.": "vSBC-Metaswitch: Event: The system encountered a critical error and had to restart.", - "Event: A RADIUS server failed to respond to an authentication request.": "vSBC-Metaswitch: Event: A RADIUS server failed to respond to an authentication request.", - "Event: All configured RADIUS servers failed to respond to authentication requests.": "vSBC-Metaswitch: Event: All configured RADIUS servers failed to respond to authentication requests.", - "Event: The number of CPUs has changed.": "vSBC-Metaswitch: Event: The number of CPUs has changed.", - "Event: A user has been automatically deleted": "vSBC-Metaswitch: Event: A user has been automatically deleted", - "The primary processor blade has lost management connectivity": "vSBC-Metaswitch: The primary processor blade has lost management connectivity", - "Event: A processor blade is running with DPDK mode disabled when DPDK mode is,expected.": "vSBC-Metaswitch: Event: A processor blade is running with DPDK mode disabled when DPDK mode is,expected.", - "Event: Processor blade %1 is running with DPDK mode disabled when DPDK mode may be possible.": "vSBC-Metaswitch: Event: Processor blade %1 is running with DPDK mode disabled when DPDK mode may be possible.", - "Perimeta is attempting to resend cached billing records.": "vSBC-Metaswitch: Perimeta is attempting to resend cached billing records.", - "The Rf billing cache is full.": "vSBC-Metaswitch: The Rf billing cache is full.", - "The inbound call queue is congested.": "vSBC-Metaswitch: The inbound call queue is congested.", - "A configured realm group contains realms that are not available to the SBC.": "vSBC-Metaswitch: A configured realm group contains realms that are not available to the SBC.", - "An allowed MSC configuration is not connected to any physical MSCs.": "vSBC-Metaswitch: An allowed MSC configuration is not connected to any physical MSCs.", - "An adjacency has failed as the listen socket could not be created. Check for configuration mismatches with the associated service interface.": "vSBC-Metaswitch: An adjacency has failed as the listen socket could not be created. Check for configuration mismatches with the associated service interface.", - "No suitable DNS records were found for a peer group's DNS hostname.": "vSBC-Metaswitch: No suitable DNS records were found for a peer group's DNS hostname.", - "One or more SIP peers from a peer group have stopped responding to SIP OPTIONS pings": "vSBC-Metaswitch: One or more SIP peers from a peer group have stopped responding to SIP OPTIONS pings", - "An adjacency has failed as its service network does not match the service network on its associated peer group.": "vSBC-Metaswitch: An adjacency has failed as its service network does not match the service network on its associated peer group.", - "An adjacency has failed as its configured TLS certificate could not be found.": "vSBC-Metaswitch: An adjacency has failed as its configured TLS certificate could not be found.", - "The caching function has not been initialized properly.": "vSBC-Metaswitch: The caching function has not been initialized properly.", - "An adjacency has failed as the listen socket could not be created.": "vSBC-Metaswitch: An adjacency has failed as the listen socket could not be created.", - "An adjacency is congested and may be rejecting calls.": "vSBC-Metaswitch: An adjacency is congested and may be rejecting calls.", - "There is an issue with a Diameter peer.": "vSBC-Metaswitch: There is an issue with a Diameter peer.", - "A realm is no longer reachable via any configured peers.": "vSBC-Metaswitch: A realm is no longer reachable via any configured peers.", - "An FQDN for a configured Diameter peer has failed to resolve to a valid IP address.": "vSBC-Metaswitch: An FQDN for a configured Diameter peer has failed to resolve to a valid IP address.", - "One or more peers resolved from a DNS lookup of a configured peer's address cannot be contacted": "vSBC-Metaswitch: One or more peers resolved from a DNS lookup of a configured peer's address cannot be contacted", - "An interface ARP or NDP probe has failed.": "vSBC-Metaswitch: An interface ARP or NDP probe has failed.", - "One or more IP address conflicts have been detected on service interfaces with zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.": "vSBC-Metaswitch: One or more IP address conflicts have been detected on service interfaces with zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.", - "One or more IP address conflicts have been detected on service interfaces with non-zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.": "vSBC-Metaswitch: One or more IP address conflicts have been detected on service interfaces with non-zero criticality. If there are other probe failures, this alarm will remain raised until all conflicts are resolved.", - "An interface device is running below the expected speed. This alarm was originally triggered by a probe failure on a service interface.": "vSBC-Metaswitch: An interface device is running below the expected speed. This alarm was originally triggered by a probe failure on a service interface.", - "An interface device is running above the expected speed.": "vSBC-Metaswitch: An interface device is running above the expected speed.", - "An IP address conflict has been detected on a management interface.": "vSBC-Metaswitch: An IP address conflict has been detected on a management interface.", - "An interface ICMP probe has failed.": "vSBC-Metaswitch: An interface ICMP probe has failed.", - "A High-Availability link has detected a connectivity issue.": "vSBC-Metaswitch: A High-Availability link has detected a connectivity issue.", - "An HA-link device is being reported as underspeed.": "vSBC-Metaswitch: An HA-link device is being reported as underspeed.", - "An IP address conflict has been detected on a replication interface.": "vSBC-Metaswitch: An IP address conflict has been detected on a replication interface.", - "The Session Controller has started.": "vSBC-Metaswitch: The Session Controller has started.", - "A statistic exceeded its configured thresholds.": "vSBC-Metaswitch: A statistic exceeded its configured thresholds.", - "One or more statistic has not been retrieved at least 3 times in a row.": "vSBC-Metaswitch: One or more statistic has not been retrieved at least 3 times in a row.", - "A Refresh Alarms request was triggered. Alarms not re-raised will be cleared in 5 minutes.": "vSBC-Metaswitch: A Refresh Alarms request was triggered. Alarms not re-raised will be cleared in 5 minutes.", - "A statistic has exceeded its configured thresholds.": "vSBC-Metaswitch: A statistic has exceeded its configured thresholds.", - "A Fallback Operation will soon be started": "vSBG: A Fallback Operation will soon be started", - "BRM, Auto Export Backup Failed": "vSBG: BRM, Auto Export Backup Failed", - "BRM, Scheduled Backup Failed": "vSBG: BRM, Scheduled Backup Failed", - "COM SA, AMF Component Cleanup Failed": "vSBG: COM SA, AMF Component Cleanup Failed", - "COM SA, AMF Component Instantiation Failed": "vSBG: COM SA, AMF Component Instantiation Failed", - "COM SA, AMF SI Unassigned": "vSBG: COM SA, AMF SI Unassigned", - "COM SA, CLM Cluster Node Unavailable": "vSBG: COM SA, CLM Cluster Node Unavailable", - "COM SA, MDF Detected Model Error": "vSBG: COM SA, MDF Detected Model Error", - "COM SA, Proxy Status of a Component Changed to Unproxied": "vSBG: COM SA, Proxy Status of a Component Changed to Unproxied", - "File Management, Number of Files in FileGroup Exceeded": "vSBG: File Management, Number of Files in FileGroup Exceeded", - "File Management, Max Size in FileGroup Exceeded": "vSBG: File Management, Max Size in FileGroup Exceeded", - "LOTC Disk Replication Communication": "vSBG: LOTC Disk Replication Communication", - "LOTC Disk Replication Consistency": "vSBG: LOTC Disk Replication Consistency", - "LOTC Disk Usage": "vSBG: LOTC Disk Usage", - "LOTC memory Usage": "vSBG: LOTC memory Usage", - "LOTC Time Synchronization": "vSBG: LOTC Time Synchronization", - "SBG, BGF Control Link Down": "vSBG: SBG, BGF Control Link Down", - "SBG, BGF Control Link Disabled": "vSBG: SBG, BGF Control Link Disabled", - "SBG, BGF Control Link Enabled": "vSBG: SBG, BGF Control Link Enabled", - "SBG, BGF Control Link Remote Locked": "vSBG: SBG, BGF Control Link Remote Locked", - "SBG, Charging Data Storage Maximum Records Reached": "vSBG: SBG, Charging Data Storage Maximum Records Reached", - "SBG, Charging Server Rejects Charging Data": "vSBG: SBG, Charging Server Rejects Charging Data", - "SBG, Excessive Packet Rate Detected ": "vSBG: SBG, Excessive Packet Rate Detected ", - "SBG, High Amount of Malformed Packets Received": "vSBG: SBG, High Amount of Malformed Packets Received", - "SBG, High Amount of STUN Packets Detected": "vSBG: SBG, High Amount of STUN Packets Detected", - "SBG, High Amount of TCP SYN Packets Received": "vSBG: SBG, High Amount of TCP SYN Packets Received", - "SBG, High Amount of UDP Packets Received ": "vSBG: SBG, High Amount of UDP Packets Received ", - "SBG, IP Address Blocked Due to Excessive Packet Rate": "vSBG: SBG, IP Address Blocked Due to Excessive Packet Rate", - "SBG, Lost Connectivity to Diameter Server": "vSBG: SBG, Lost Connectivity to Diameter Server", - "SBG, Mated Pair out of Service": "vSBG: SBG, Mated Pair out of Service", - "SBG, Network Unavailable for Media Handling": "vSBG: SBG, Network Unavailable for Media Handling", - "SBG, Non-emergency Call Released to Free Resources for Emergency Call": "vSBG: SBG, Non-emergency Call Released to Free Resources for Emergency Call", - "SBG, Not Enough Disk Space for Storing Charging Data": "vSBG: SBG, Not Enough Disk Space for Storing Charging Data", - "SBG, Payload Mated Pair Failure": "vSBG: SBG, Payload Mated Pair Failure", - "SBG, Payload Processor Failure": "vSBG: SBG, Payload Processor Failure", - "SBG, Processor Overloaded": "vSBG: SBG, Processor Overloaded", - "SBG, Registered User Set in Quarantine": "vSBG: SBG, Registered User Set in Quarantine", - "SBG, Registration Contacts Exceed Configured Threshold": "vSBG: SBG, Registration Contacts Exceed Configured Threshold", - "SBG, Sequential Restart Initiated": "vSBG: SBG, Sequential Restart Initiated", - "SBG, SIP Abuse Detected": "vSBG: SBG, SIP Abuse Detected", - "SBG, SIP Network Locked": "vSBG: SBG, SIP Network Locked", - "SBG, SIP Next Hop Reachable": "vSBG: SBG, SIP Next Hop Reachable", - "SBG, SIP Next Hop Unreachable": "vSBG: SBG, SIP Next Hop Unreachable", - "SBG, SIP Request Rejected by Network Throttling": "vSBG: SBG, SIP Request Rejected by Network Throttling", - "SBG, TLS Certificate Imported": "vSBG: SBG, TLS Certificate Imported", - "SBG, Trace Recording Session Number Limit Reached": "vSBG: SBG, Trace Recording Session Number Limit Reached", - "SBG, Trace Session Deactivated": "vSBG: SBG, Trace Session Deactivated", - "SBG, Trace Session Times Out": "vSBG: SBG, Trace Session Times Out", - "SBG, Unknown Media Type or Payload Type": "vSBG: SBG, Unknown Media Type or Payload Type" -} diff --git a/src/test/resources/example/dao/bpmn-prop.json b/src/test/resources/example/dao/bpmn-prop.json index f1b87a006..a38d58c3b 100644 --- a/src/test/resources/example/dao/bpmn-prop.json +++ b/src/test/resources/example/dao/bpmn-prop.json @@ -5,6 +5,80 @@ "value": "uktukk" } ], + "TCA_11n5nl9": { + "group1": [ + { + "name": "tname", + "value": "group1" + }, + { + "name": "tuuid", + "value": "f734f031-10aa-t8fb-330f-04dde2886325" + }, + { + "name": "tcaPolId", + "value": "policy1" + }, + { + "name": "eventName", + "value": "vFirewallBroadcastPackets" + }, + { + "name": "controlLoopSchemaType", + "value": "VNF" + }, + { + "serviceConfigurations": [ + [ + "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value", + "LESS_OR_EQUAL", + "123", + "ABATED" + ], + [ + "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value", + "GREATER_OR_EQUAL", + "123", + "ONSET" + ] + ] + } + ] + }, + "global": + [ + { + "name": "service", + "value": + [ + "0f983e18-4603-4bb4-a98c-e29691fb16a1" + ] + }, + + { + "name": "vf", + "value": + [ + "6c7aaec2-59eb-41d9-8681-b7f976ab668d" + ] + }, + + { + "name": "actionSet", + "value": + [ + "vnfRecipe" + ] + }, + + { + "name": "location", + "value": + [ + "SNDGCA64" + ] + } + ], "Policy_19c1hms": { "policy1": [ { diff --git a/src/test/resources/example/json-editor-schema/tca-policy-json-editor-schema.json b/src/test/resources/example/json-editor-schema/tca-policy-json-editor-schema.json new file mode 100644 index 000000000..11b91dfb4 --- /dev/null +++ b/src/test/resources/example/json-editor-schema/tca-policy-json-editor-schema.json @@ -0,0 +1,115 @@ +{ + "schema": { + "uniqueItems": "true", + "format": "tabs-top", + "type": "array", + "title": "Thresholds", + "items": { + "type": "object", + "title": "Thresholds", + "required": [ + "dummySignatures" + ], + "properties": { + "severity": { + "propertyOrder": 1004, + "title": "event severity or priority", + "type": "string", + "enum": [ + "CRITICAL", + "MAJOR", + "MINOR", + "WARNING", + "NORMAL" + ] + }, + "fieldPath": { + "propertyOrder": 1003, + "title": "Field Path", + "type": "string" + }, + "thresholdValue": { + "propertyOrder": 1005, + "default": 0, + "maximum": 65535, + "title": "ThresholdValue", + "type": "integer", + "minimum": 0 + }, + "dummySignatures": { + "propertyOrder": 1007, + "uniqueItems": "true", + "format": "tabs-top", + "title": "dummy Signatures", + "type": "array", + "items": { + "type": "object", + "required": [ + "signature", + "traversal" + ], + "properties": { + "signature": { + "propertyOrder": 1008, + "required": [ + "filter_clause" + ], + "properties": { + "filter_clause": { + "propertyOrder": 20002, + "title": "Filter Clause", + "type": "string", + "enum": [ + "OR", + "AND", + "NOT" + ] + } + } + }, + "traversal": { + "propertyOrder": 1009, + "required": [ + "traversal" + ], + "properties": { + "traversal": { + "propertyOrder": 20003, + "title": "Dummy Traverse", + "type": "string", + "enum": [ + "ONE", + "TWO", + "THREE" + ] + } + } + } + } + } + }, + "closedLoopControlName": { + "propertyOrder": 1001, + "title": "A UNIQUE string identifying the Closed Loop ID this event is for.", + "type": "string" + }, + "version": { + "propertyOrder": 1006, + "minLength": 1, + "title": "Version for the closed loop message", + "type": "string" + }, + "direction": { + "propertyOrder": 1002, + "type": "string", + "enum": [ + "LESS", + "LESS_OR_EQUAL", + "GREATER", + "GREATER_OR_EQUAL" + ] + } + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/example/model-properties/tca_new/model-bpmn.json b/src/test/resources/example/model-properties/tca_new/model-bpmn.json new file mode 100644 index 000000000..84964c55d --- /dev/null +++ b/src/test/resources/example/model-properties/tca_new/model-bpmn.json @@ -0,0 +1,21 @@ +{ + "policy": [ + { + "id": "Policy_12lup3h", + "from": "TCA_1d13unw" + } + ], + "tca": [ + { + "id": "TCA_1d13unw", + "from": "VesCollector_1g9cmz0" + } + ], + "holmes": [], + "vesCollector": [ + { + "id": "VesCollector_1g9cmz0", + "from": "StartEvent_1" + } + ] +}
\ No newline at end of file diff --git a/src/test/resources/example/sdc/sdcAlarmsList.csv b/src/test/resources/example/sdc/sdcAlarmsList.csv index 247dcd9aa..43ffdd348 100644 --- a/src/test/resources/example/sdc/sdcAlarmsList.csv +++ b/src/test/resources/example/sdc/sdcAlarmsList.csv @@ -1,13 +1,13 @@ ,EventSourceType,,AlarmCondition,Severity -eventType,VPMS,alarmCondition,SwRestart,CRITICAL +eventType,VNFNAME,alarmCondition,SwRestart,CRITICAL -eventType,VPMS,alarmCondition,SwRestart,WARNING +eventType,VNFNAME,alarmCondition,SwRestart,WARNING -eventType,VPMS,alarmCondition,SwRestart,OK +eventType,VNFNAME,alarmCondition,SwRestart,OK -eventType,VPMS,alarmCondition,IsAlive,CRITICAL +eventType,VNFNAME,alarmCondition,IsAlive,CRITICAL -eventType,VPMS,alarmCondition,IsAlive,WARNING +eventType,VNFNAME,alarmCondition,IsAlive,WARNING -eventType,VPMS,alarmCondition,IsAlive,OK +eventType,VNFNAME,alarmCondition,IsAlive,OK diff --git a/src/test/resources/example/sdc/sdcCVFCResourceExample.json b/src/test/resources/example/sdc/sdcCVFCResourceExample.json index 01998dcbc..16ebe74d2 100644 --- a/src/test/resources/example/sdc/sdcCVFCResourceExample.json +++ b/src/test/resources/example/sdc/sdcCVFCResourceExample.json @@ -10,7 +10,7 @@ "lifecycleState": "CERTIFIED", "lastUpdaterUserId": "user", "lastUpdaterFullName": "Zero ASDCMech", - "toscaResourceName": "org.openecomp.resource.vfc.ClampDev.abstract.nodes.virc_fe_be_0", + "toscaResourceName": "org.onap.resource.vfc.ClampDev.abstract.nodes.virc_fe_be_0", "resources": [ { "resourceInstanceName": "virc_fe_be_virc_fe_be_management_0_port", diff --git a/src/test/resources/example/sdc/sdcCVFCResources.json b/src/test/resources/example/sdc/sdcCVFCResources.json index 54003a642..e8743bba9 100644 --- a/src/test/resources/example/sdc/sdcCVFCResources.json +++ b/src/test/resources/example/sdc/sdcCVFCResources.json @@ -266,7 +266,7 @@ { "uuid": "cba89050-752c-4aac-8cec-6f0463eb8a23", "invariantUUID": "ac6fab25-abc6-4e0e-ba25-cc2ddd7a51ef", - "name": "LDSA-nodes.ltm", + "name": "VNF-nodes.ltm", "version": "1.0", "toscaModelURL": "/sdc/v1/catalog/resources/cba89050-752c-4aac-8cec-6f0463eb8a23/toscaModel", "category": "Generic", diff --git a/src/test/resources/example/sdc/sdcCinderVolume.json b/src/test/resources/example/sdc/sdcCinderVolume.json index 1832a9aa5..776226c8d 100644 --- a/src/test/resources/example/sdc/sdcCinderVolume.json +++ b/src/test/resources/example/sdc/sdcCinderVolume.json @@ -10,6 +10,6 @@ "lifecycleState": "CERTIFIED", "lastUpdaterUserId": "user", "lastUpdaterFullName": "Jimmy Hendrix", - "toscaResourceName": "org.openecomp.resource.vfc.nodes.heat.cinder.Volume", + "toscaResourceName": "org.onap.resource.vfc.nodes.heat.cinder.Volume", "description": "Represents a server-local block storage device that provides persistent storage to guest virtual machines. " }
\ No newline at end of file diff --git a/src/test/resources/example/sdc/sdcResourceDetailsExample.json b/src/test/resources/example/sdc/sdcResourceDetailsExample.json index 7653b9481..16c5708f1 100644 --- a/src/test/resources/example/sdc/sdcResourceDetailsExample.json +++ b/src/test/resources/example/sdc/sdcResourceDetailsExample.json @@ -10,7 +10,7 @@ "lifecycleState": "CERTIFIED", "lastUpdaterUserId": "user", "lastUpdaterFullName": "Three ASDCMech", - "toscaResourceName": "org.openecomp.resource.vf.ClampDev", + "toscaResourceName": "org.onap.resource.vf.ClampDev", "resources": [ { diff --git a/src/test/resources/example/sdc/sdcSecurityRules.json b/src/test/resources/example/sdc/sdcSecurityRules.json index b73abb058..a7a641239 100644 --- a/src/test/resources/example/sdc/sdcSecurityRules.json +++ b/src/test/resources/example/sdc/sdcSecurityRules.json @@ -10,6 +10,6 @@ "lifecycleState": "CERTIFIED", "lastUpdaterUserId": "user", "lastUpdaterFullName": "Jimmy Hendrix", - "toscaResourceName": "org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules", + "toscaResourceName": "org.onap.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules", "description": "Configuration of policy rules to be applied on ports." }
\ No newline at end of file diff --git a/src/test/resources/example/sdc/sdcServiceDetailsExample.json b/src/test/resources/example/sdc/sdcServiceDetailsExample.json index b344f4194..57232503d 100644 --- a/src/test/resources/example/sdc/sdcServiceDetailsExample.json +++ b/src/test/resources/example/sdc/sdcServiceDetailsExample.json @@ -10,7 +10,7 @@ "lifecycleState": "CERTIFIED", "lastUpdaterUserId": "user", "lastUpdaterFullName": "MONICA LAZER", - "toscaResourceName": "org.openecomp.resource.vf.Vcts3", + "toscaResourceName": "org.onap.resource.vf.Vcts3", "resources": [ { @@ -79,11 +79,11 @@ { "artifactChecksum": "CheckSum", - "artifactDescription": "Nimbus Heat OAM", - "artifactName": "hot-nimbus-oam_v1.0.yaml", + "artifactDescription": "Test desc", + "artifactName": "vnf_v1.0.yaml", "artifactTimeout": 100, "artifactType": "HEAT", - "artifactURL": "hot-nimbus-oam_v1.0.yaml", + "artifactURL": "vnf_v1.0.yaml", "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2", @@ -96,10 +96,10 @@ { "artifactChecksum": "CheckSum", - "artifactDescription": "Nimbus Heat ENV OAM", - "artifactName": "hot-nimbus-oam_v1.0.env", + "artifactDescription": "Vnf desc", + "artifactName": "vnf_v1.0.env", "artifactType": "HEAT_ENV", - "artifactURL": "hot-nimbus-oam_v1.0.env", + "artifactURL": "vnf_v1.0.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" }, @@ -128,11 +128,11 @@ { "artifactChecksum": "CheckSum", - "artifactDescription": "Script for Nimbus", - "artifactName": "cloud-nimbus.sh", + "artifactDescription": "Script for Vnf", + "artifactName": "cloud-Vnf.sh", "artifactType": "HEAT_ARTIFACT", - "artifactURL": "cloud-nimbus.sh", - "artifactUUID": "ScriptNimbusArtifact-UUID1", + "artifactURL": "cloud-Vnf.sh", + "artifactUUID": "ScriptVnfArtifact-UUID1", "artifactVersion": "1.0" }, @@ -149,10 +149,10 @@ { "artifactChecksum": "CheckSum", "artifactDescription": "Heat Vol for OAM", - "artifactName": "hot-nimbus-oam-volumes_v1.0.yaml", + "artifactName": "vnf-volumes_v1.0.yaml", "artifactTimeout": 10, "artifactType": "HEAT_VOL", - "artifactURL": "hot-nimbus-oam-volumes_v1.0.yaml", + "artifactURL": "vnf-volumes_v1.0.yaml", "artifactUUID": "VolumeArtifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "VolumeEnvArtifact-UUID1", @@ -165,9 +165,9 @@ { "artifactChecksum": "CheckSum", "artifactDescription": "Heat Env Vol for OAM", - "artifactName": "hot-nimbus-oam-volumes_v1.0.env", + "artifactName": "vnf-volumes_v1.0.env", "artifactType": "HEAT_ENV", - "artifactURL": "hot-nimbus-oam-volumes_v1.0.env", + "artifactURL": "vnf-volumes_v1.0.env", "artifactUUID": "VolumeEnvArtifact-UUID1", "artifactVersion": "1.0" }, @@ -175,10 +175,10 @@ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", - "artifactName": "att_nimbus_vsaegw_ht_base_v13_0728v1.yaml", + "artifactName": "vnf_1.yaml", "artifactTimeout": 100, "artifactType": "HEAT", - "artifactURL": "att_nimbus_vsaegw_ht_base_v13_0728v1.yaml", + "artifactURL": "vnf_1.yaml", "artifactUUID": "HeatArtifactE2E-UUIDTest", "artifactVersion": "1.0" } diff --git a/src/test/resources/example/sdc/sdcVFCGenericWithAlarms.json b/src/test/resources/example/sdc/sdcVFCGenericWithAlarms.json index 952650af4..5534d992c 100644 --- a/src/test/resources/example/sdc/sdcVFCGenericWithAlarms.json +++ b/src/test/resources/example/sdc/sdcVFCGenericWithAlarms.json @@ -10,7 +10,7 @@ "lifecycleState": "CERTIFIED", "lastUpdaterUserId": "user", "lastUpdaterFullName": "Zero ASDCMech", - "toscaResourceName": "org.openecomp.resource.vfc.ClampDev.abstract.nodes.virc_fe_be_1", + "toscaResourceName": "org.onap.resource.vfc.ClampDev.abstract.nodes.virc_fe_be_1", "resources": [ { diff --git a/src/test/resources/example/sdc/sdcVFCResourceExample.json b/src/test/resources/example/sdc/sdcVFCResourceExample.json index 5f523e6bd..0b0d5811a 100644 --- a/src/test/resources/example/sdc/sdcVFCResourceExample.json +++ b/src/test/resources/example/sdc/sdcVFCResourceExample.json @@ -10,7 +10,7 @@ "lifecycleState": "CERTIFIED", "lastUpdaterUserId": "user", "lastUpdaterFullName": "Zero ASDCMech", - "toscaResourceName": "org.openecomp.resource.vfc.Clampdev.abstract.nodes.heat.virc_fe_be", + "toscaResourceName": "org.onap.resource.vfc.Clampdev.abstract.nodes.heat.virc_fe_be", "artifacts": [ { "artifactName": "Fault-alarms-ASDC-vprobes-vLB.csv", diff --git a/src/test/resources/example/sdc/sdcVFResources.json b/src/test/resources/example/sdc/sdcVFResources.json index 4274ba8fc..e9d1d3b85 100644 --- a/src/test/resources/example/sdc/sdcVFResources.json +++ b/src/test/resources/example/sdc/sdcVFResources.json @@ -483,7 +483,7 @@ { "uuid": "6b934b9d-0785-4b46-8321-943a12b8031b", "invariantUUID": "785012c2-fdd8-450d-8fa2-81ff60e25f1e", - "name": "vMMSC_AIC3.0__multi_members_multi_groups_volume.cs", + "name": "VNFNAME__multi_members_multi_groups_volume.cs", "version": "0.2", "toscaModelURL": "/sdc/v1/catalog/resources/6b934b9d-0785-4b46-8321-943a12b8031b/toscaModel", "category": "Application L4+", @@ -574,7 +574,7 @@ { "uuid": "c8663b6e-bbe2-401d-9500-ec5425463655", "invariantUUID": "925243cf-e342-4d86-8558-63899fbe88da", - "name": "VF Module LDSA", + "name": "VF Module VNF", "version": "1.1", "toscaModelURL": "/sdc/v1/catalog/resources/c8663b6e-bbe2-401d-9500-ec5425463655/toscaModel", "category": "Application L4+", @@ -665,7 +665,7 @@ { "uuid": "c1c02cff-855f-438e-85f8-40c362874896", "invariantUUID": "64cb5201-90d4-4cab-a6a9-f7416eeb307f", - "name": "PXTC", + "name": "VNFName", "version": "0.1", "toscaModelURL": "/sdc/v1/catalog/resources/c1c02cff-855f-438e-85f8-40c362874896/toscaModel", "category": "Application L4+", @@ -678,7 +678,7 @@ { "uuid": "837c2fee-c2b2-4e95-ad48-dd69772d99bd", "invariantUUID": "e48b3ea8-39bc-41eb-84bf-f5ef267d31e4", - "name": "vMOG VNF 1", + "name": "VNF 1", "version": "0.1", "toscaModelURL": "/sdc/v1/catalog/resources/837c2fee-c2b2-4e95-ad48-dd69772d99bd/toscaModel", "category": "Network L2-3", @@ -756,7 +756,7 @@ { "uuid": "1e7f07c7-ff4c-40a6-95f6-a9b05f138027", "invariantUUID": "cfff70d2-f942-4b25-b2ca-e64f64af511d", - "name": "vMMSC_AIC3.0__multi_members_multi_groups_volume", + "name": "VNFNAME__multi_members_multi_groups_volume", "version": "2.0", "toscaModelURL": "/sdc/v1/catalog/resources/1e7f07c7-ff4c-40a6-95f6-a9b05f138027/toscaModel", "category": "Application L4+", @@ -938,7 +938,7 @@ { "uuid": "c9ea2798-f3ba-4826-ae93-0786820cb890", "invariantUUID": "5882c528-76fe-4884-90c7-71301ca52cf8", - "name": "vMMSC_ECA", + "name": "VNFNAME1", "version": "0.1", "toscaModelURL": "/sdc/v1/catalog/resources/c9ea2798-f3ba-4826-ae93-0786820cb890/toscaModel", "category": "Application L4+", @@ -1016,7 +1016,7 @@ { "uuid": "3951e021-7595-43b1-a6fd-de077c01af54", "invariantUUID": "925243cf-e342-4d86-8558-63899fbe88da", - "name": "VF Module LDSA", + "name": "VF Module VNF", "version": "1.0", "toscaModelURL": "/sdc/v1/catalog/resources/3951e021-7595-43b1-a6fd-de077c01af54/toscaModel", "category": "Application L4+", @@ -1068,7 +1068,7 @@ { "uuid": "70974b30-6b89-41d2-8b5d-779279db3b96", "invariantUUID": "725e5fd1-2520-4669-a5f2-23f9ad2fbec4", - "name": "vSCP0502", + "name": "VnfName2", "version": "1.0", "toscaModelURL": "/sdc/v1/catalog/resources/70974b30-6b89-41d2-8b5d-779279db3b96/toscaModel", "category": "Application L4+", @@ -1081,7 +1081,7 @@ { "uuid": "c9e436c3-539f-45e2-90b4-b046af907877", "invariantUUID": "bc7fe896-e286-41cb-a11f-7081fc92876b", - "name": "vMMSC", + "name": "VNFNAME", "version": "0.1", "toscaModelURL": "/sdc/v1/catalog/resources/c9e436c3-539f-45e2-90b4-b046af907877/toscaModel", "category": "Application L4+", @@ -1120,7 +1120,7 @@ { "uuid": "82460d6a-1cd7-4c57-bc89-625600555f80", "invariantUUID": "c67108d4-a0b0-4eee-8fbc-c881d7bb21d3", - "name": "VF modules vMMSC", + "name": "VF modules VNFNAME", "version": "1.0", "toscaModelURL": "/sdc/v1/catalog/resources/82460d6a-1cd7-4c57-bc89-625600555f80/toscaModel", "category": "Application L4+", @@ -1172,7 +1172,7 @@ { "uuid": "ac603264-cdf7-49ab-a9ae-92d341023218", "invariantUUID": "379ab526-dc81-4b31-b60d-31c1805ddf5a", - "name": "FDNT1", + "name": "VnfName1", "version": "0.1", "toscaModelURL": "/sdc/v1/catalog/resources/ac603264-cdf7-49ab-a9ae-92d341023218/toscaModel", "category": "Application L4+", @@ -1237,7 +1237,7 @@ { "uuid": "44ff8000-e703-4538-b26a-f2bc8205d7d4", "invariantUUID": "26badc5a-d29e-4583-b773-0d42366a8bb1", - "name": "FDNT1234", + "name": "VnfName1234", "version": "1.0", "toscaModelURL": "/sdc/v1/catalog/resources/44ff8000-e703-4538-b26a-f2bc8205d7d4/toscaModel", "category": "Network L2-3", @@ -1315,7 +1315,7 @@ { "uuid": "8dec3b8a-a0fa-4634-bbb4-d7bad5a912ab", "invariantUUID": "eda652e4-6740-46bf-8d0f-92c4752070f6", - "name": "FCGI_OS", + "name": "VNFNAME", "version": "0.1", "toscaModelURL": "/sdc/v1/catalog/resources/8dec3b8a-a0fa-4634-bbb4-d7bad5a912ab/toscaModel", "category": "Application L4+", @@ -1419,7 +1419,7 @@ { "uuid": "da3619c1-9b19-4edc-9853-a714c5034371", "invariantUUID": "b90f7990-667a-4f63-9e7f-ee02f64766f1", - "name": "FDNT", + "name": "VnfName2", "version": "0.1", "toscaModelURL": "/sdc/v1/catalog/resources/da3619c1-9b19-4edc-9853-a714c5034371/toscaModel", "category": "Application L4+", diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/228aac11-6e48-4412-afbf-327c5c3b04fb/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/228aac11-6e48-4412-afbf-327c5c3b04fb/metadata/.file index 8b9114f19..5a84698e3 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/228aac11-6e48-4412-afbf-327c5c3b04fb/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/228aac11-6e48-4412-afbf-327c5c3b04fb/metadata/.file @@ -1 +1 @@ -{"uuid":"228aac11-6e48-4412-afbf-327c5c3b04fb","invariantUUID":"ba4d4b5d-f861-4155-886b-b1cdba5e0957","name":"vLoadBalancer-nodes.vlbCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/228aac11-6e48-4412-afbf-327c5c3b04fb/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vloadbalancercvfc.abstract.nodes.vlb","resources":[{"resourceInstanceName":"vlb_vlb_private_2_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vlb_vlb_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vlb","resourceName":"Vloadbalancer.nodes.heat.vlb","resourceInvariantUUID":"3ff44c1d-0384-4501-8e33-dd3000799378","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d"},{"resourceInstanceName":"vlb_vlb_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file +{"uuid":"228aac11-6e48-4412-afbf-327c5c3b04fb","invariantUUID":"ba4d4b5d-f861-4155-886b-b1cdba5e0957","name":"vLoadBalancer-nodes.vlbCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/228aac11-6e48-4412-afbf-327c5c3b04fb/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vloadbalancercvfc.abstract.nodes.vlb","resources":[{"resourceInstanceName":"vlb_vlb_private_2_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vlb_vlb_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vlb","resourceName":"Vloadbalancer.nodes.heat.vlb","resourceInvariantUUID":"3ff44c1d-0384-4501-8e33-dd3000799378","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d"},{"resourceInstanceName":"vlb_vlb_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/2bbcbcce-f9e2-4f5d-b975-1f1122d3226c/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/2bbcbcce-f9e2-4f5d-b975-1f1122d3226c/metadata/.file index da4363f14..e0b3cd72b 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/2bbcbcce-f9e2-4f5d-b975-1f1122d3226c/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/2bbcbcce-f9e2-4f5d-b975-1f1122d3226c/metadata/.file @@ -1 +1 @@ -{"uuid":"2bbcbcce-f9e2-4f5d-b975-1f1122d3226c","invariantUUID":"28142b9a-7925-4921-bc81-178c5bae4a9b","name":"vPacketGen-nodes.vpgCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/2bbcbcce-f9e2-4f5d-b975-1f1122d3226c/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vpacketgencvfc.abstract.nodes.vpg","resources":[{"resourceInstanceName":"vpg_vpg_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vpg","resourceName":"Vpacketgen.nodes.heat.vpg","resourceInvariantUUID":"86769df9-139b-489f-949d-05efb7f0ed6a","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"c8a01686-2762-483c-98ad-a66606b9947f"},{"resourceInstanceName":"vpg_vpg_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file +{"uuid":"2bbcbcce-f9e2-4f5d-b975-1f1122d3226c","invariantUUID":"28142b9a-7925-4921-bc81-178c5bae4a9b","name":"vPacketGen-nodes.vpgCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/2bbcbcce-f9e2-4f5d-b975-1f1122d3226c/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vpacketgencvfc.abstract.nodes.vpg","resources":[{"resourceInstanceName":"vpg_vpg_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vpg","resourceName":"Vpacketgen.nodes.heat.vpg","resourceInvariantUUID":"86769df9-139b-489f-949d-05efb7f0ed6a","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"c8a01686-2762-483c-98ad-a66606b9947f"},{"resourceInstanceName":"vpg_vpg_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/38b62ebd-276a-48e8-948b-de76c81d6686/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/38b62ebd-276a-48e8-948b-de76c81d6686/metadata/.file index 05f714755..9f7173266 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/38b62ebd-276a-48e8-948b-de76c81d6686/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/38b62ebd-276a-48e8-948b-de76c81d6686/metadata/.file @@ -1 +1 @@ -{"uuid":"38b62ebd-276a-48e8-948b-de76c81d6686","invariantUUID":"2ef814e3-7c17-420c-bdba-e84e338cd991","name":"vLoadBalancer-nodes.vdns_1Cvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/38b62ebd-276a-48e8-948b-de76c81d6686/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vloadbalancercvfc.abstract.nodes.vdns_1","resources":[{"resourceInstanceName":"vdns_vdns_2_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vdns","resourceName":"Vloadbalancer.nodes.heat.vdns","resourceInvariantUUID":"b4ad5952-aa22-4645-ac57-72d55c8833be","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"cca286e8-5ac0-451c-b874-8cc307181e10"},{"resourceInstanceName":"vdns_vdns_2_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file +{"uuid":"38b62ebd-276a-48e8-948b-de76c81d6686","invariantUUID":"2ef814e3-7c17-420c-bdba-e84e338cd991","name":"vLoadBalancer-nodes.vdns_1Cvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/38b62ebd-276a-48e8-948b-de76c81d6686/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vloadbalancercvfc.abstract.nodes.vdns_1","resources":[{"resourceInstanceName":"vdns_vdns_2_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vdns","resourceName":"Vloadbalancer.nodes.heat.vdns","resourceInvariantUUID":"b4ad5952-aa22-4645-ac57-72d55c8833be","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"cca286e8-5ac0-451c-b874-8cc307181e10"},{"resourceInstanceName":"vdns_vdns_2_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/68bb176c-8d5f-4d27-8407-fd8d9e5910eb/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/68bb176c-8d5f-4d27-8407-fd8d9e5910eb/metadata/.file index 9985a8be8..46e4922d2 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/68bb176c-8d5f-4d27-8407-fd8d9e5910eb/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/68bb176c-8d5f-4d27-8407-fd8d9e5910eb/metadata/.file @@ -1 +1 @@ -{"uuid":"68bb176c-8d5f-4d27-8407-fd8d9e5910eb","invariantUUID":"1a12347c-6166-4d21-9861-b2c432722a23","name":"Vfirewall.nodes.heat.vfw","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/68bb176c-8d5f-4d27-8407-fd8d9e5910eb/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vfirewall.abstract.nodes.heat.vfw","description":"Not reusable inner VFC"}
\ No newline at end of file +{"uuid":"68bb176c-8d5f-4d27-8407-fd8d9e5910eb","invariantUUID":"1a12347c-6166-4d21-9861-b2c432722a23","name":"Vfirewall.nodes.heat.vfw","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/68bb176c-8d5f-4d27-8407-fd8d9e5910eb/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vfirewall.abstract.nodes.heat.vfw","description":"Not reusable inner VFC"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/701bf7b7-ddf1-4658-af5f-66c815348fd3/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/701bf7b7-ddf1-4658-af5f-66c815348fd3/metadata/.file index bbae2420e..0469714bb 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/701bf7b7-ddf1-4658-af5f-66c815348fd3/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/701bf7b7-ddf1-4658-af5f-66c815348fd3/metadata/.file @@ -1 +1 @@ -{"uuid":"701bf7b7-ddf1-4658-af5f-66c815348fd3","invariantUUID":"53ebeed7-84db-4638-b1f3-8ed44c75985b","name":"vFirewall-nodes.vfwCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/701bf7b7-ddf1-4658-af5f-66c815348fd3/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vfirewallcvfc.abstract.nodes.vfw","resources":[{"resourceInstanceName":"vfw_vfw_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vfw_vfw_private_2_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vfw_vfw_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vfw","resourceName":"Vfirewall.nodes.heat.vfw","resourceInvariantUUID":"1a12347c-6166-4d21-9861-b2c432722a23","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"68bb176c-8d5f-4d27-8407-fd8d9e5910eb"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file +{"uuid":"701bf7b7-ddf1-4658-af5f-66c815348fd3","invariantUUID":"53ebeed7-84db-4638-b1f3-8ed44c75985b","name":"vFirewall-nodes.vfwCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/701bf7b7-ddf1-4658-af5f-66c815348fd3/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vfirewallcvfc.abstract.nodes.vfw","resources":[{"resourceInstanceName":"vfw_vfw_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vfw_vfw_private_2_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vfw_vfw_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vfw","resourceName":"Vfirewall.nodes.heat.vfw","resourceInvariantUUID":"1a12347c-6166-4d21-9861-b2c432722a23","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"68bb176c-8d5f-4d27-8407-fd8d9e5910eb"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/8fb4db8b-1d1f-4369-8611-0375d86f0051/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/8fb4db8b-1d1f-4369-8611-0375d86f0051/metadata/.file index 940d0ecc4..6c99b6997 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/8fb4db8b-1d1f-4369-8611-0375d86f0051/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/8fb4db8b-1d1f-4369-8611-0375d86f0051/metadata/.file @@ -1 +1 @@ -{"uuid":"8fb4db8b-1d1f-4369-8611-0375d86f0051","invariantUUID":"05e3e25f-b671-433f-8ea6-835c198c15ae","name":"Vloadbalancer.nodes.heat.vpg","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/8fb4db8b-1d1f-4369-8611-0375d86f0051/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vloadbalancer.abstract.nodes.heat.vpg","description":"Not reusable inner VFC"}
\ No newline at end of file +{"uuid":"8fb4db8b-1d1f-4369-8611-0375d86f0051","invariantUUID":"05e3e25f-b671-433f-8ea6-835c198c15ae","name":"Vloadbalancer.nodes.heat.vpg","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/8fb4db8b-1d1f-4369-8611-0375d86f0051/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vloadbalancer.abstract.nodes.heat.vpg","description":"Not reusable inner VFC"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/948da0c9-536e-4688-85eb-d906fe7324b3/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/948da0c9-536e-4688-85eb-d906fe7324b3/metadata/.file index 53fa9e394..5689e38a1 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/948da0c9-536e-4688-85eb-d906fe7324b3/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/948da0c9-536e-4688-85eb-d906fe7324b3/metadata/.file @@ -1 +1 @@ -{"uuid":"948da0c9-536e-4688-85eb-d906fe7324b3","invariantUUID":"702cbc3d-5669-426d-aba6-6ddf4d4a702b","name":"vLoadBalancer-nodes.vpgCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/948da0c9-536e-4688-85eb-d906fe7324b3/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vloadbalancercvfc.abstract.nodes.vpg","resources":[{"resourceInstanceName":"vpg","resourceName":"Vloadbalancer.nodes.heat.vpg","resourceInvariantUUID":"05e3e25f-b671-433f-8ea6-835c198c15ae","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"8fb4db8b-1d1f-4369-8611-0375d86f0051"},{"resourceInstanceName":"vpg_vpg_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vpg_vpg_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file +{"uuid":"948da0c9-536e-4688-85eb-d906fe7324b3","invariantUUID":"702cbc3d-5669-426d-aba6-6ddf4d4a702b","name":"vLoadBalancer-nodes.vpgCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/948da0c9-536e-4688-85eb-d906fe7324b3/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vloadbalancercvfc.abstract.nodes.vpg","resources":[{"resourceInstanceName":"vpg","resourceName":"Vloadbalancer.nodes.heat.vpg","resourceInvariantUUID":"05e3e25f-b671-433f-8ea6-835c198c15ae","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"8fb4db8b-1d1f-4369-8611-0375d86f0051"},{"resourceInstanceName":"vpg_vpg_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vpg_vpg_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/metadata/.file index 2a272ee6f..dd564ea9a 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/metadata/.file @@ -1 +1 @@ -{"uuid":"98c27d0b-9395-4f8b-87ab-e076cd1f627e","invariantUUID":"07e266fc-49ab-4cd7-8378-ca4676f1b9ec","name":"vFirewall","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/toscaModel","category":"Application L4+","subCategory":"Firewall","resourceType":"VF","lifecycleState":"CERTIFIED","lastUpdaterUserId":"jm0007","lastUpdaterFullName":"Joni Mitchell","toscaResourceName":"org.openecomp.resource.vf.Vfirewall","resources":[{"resourceInstanceName":"unprotected_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"},{"resourceInstanceName":"abstract_vfw","resourceName":"vFirewall-nodes.vfwCvfc","resourceInvariantUUID":"53ebeed7-84db-4638-b1f3-8ed44c75985b","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"701bf7b7-ddf1-4658-af5f-66c815348fd3"},{"resourceInstanceName":"protected_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"},{"resourceInstanceName":"abstract_vsn","resourceName":"vFirewall-nodes.vsnCvfc","resourceInvariantUUID":"74805001-19f5-4c2c-9928-03014161c32a","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"d6a5add1-162a-4966-80a6-8ba53d83b17f"}],"artifacts":[{"artifactName":"vf-license-model.xml","artifactType":"VF_LICENSE","artifactURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/artifacts/6e816af9-944d-46d0-826d-5ff7be063a01","artifactDescription":"VF license file","artifactChecksum":"Njg4NTI4ZWY2MTliMGQzOGZmNDA4ZjRiMjllZmJkMzM=","artifactUUID":"6e816af9-944d-46d0-826d-5ff7be063a01","artifactVersion":"1","artifactLabel":"vflicense","artifactGroupType":"DEPLOYMENT"},{"artifactName":"base_vfw.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/artifacts/cbc75b18-86d1-4139-95f2-1d91f79a8b25","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"M2I1YmVjNzZkY2MxMWJkYTM5NzA3NDVhMGQxMzY2MDA=","artifactUUID":"cbc75b18-86d1-4139-95f2-1d91f79a8b25","artifactVersion":"2","artifactLabel":"heat1","artifactGroupType":"DEPLOYMENT"},{"artifactName":"vendor-license-model.xml","artifactType":"VENDOR_LICENSE","artifactURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/artifacts/5b592087-76bf-4c43-a1e7-d4151ce51cdd","artifactDescription":" Vendor license file","artifactChecksum":"Mjc0NGViYzYyNWZkZTRmYWFkYmUzZjY1MmEwNzRjZDE=","artifactUUID":"5b592087-76bf-4c43-a1e7-d4151ce51cdd","artifactVersion":"1","artifactLabel":"vendorlicense","artifactGroupType":"DEPLOYMENT"}],"description":"vFW, vSink"}
\ No newline at end of file +{"uuid":"98c27d0b-9395-4f8b-87ab-e076cd1f627e","invariantUUID":"07e266fc-49ab-4cd7-8378-ca4676f1b9ec","name":"vFirewall","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/toscaModel","category":"Application L4+","subCategory":"Firewall","resourceType":"VF","lifecycleState":"CERTIFIED","lastUpdaterUserId":"jm0007","lastUpdaterFullName":"Joni Mitchell","toscaResourceName":"org.onap.resource.vf.Vfirewall","resources":[{"resourceInstanceName":"unprotected_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"},{"resourceInstanceName":"abstract_vfw","resourceName":"vFirewall-nodes.vfwCvfc","resourceInvariantUUID":"53ebeed7-84db-4638-b1f3-8ed44c75985b","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"701bf7b7-ddf1-4658-af5f-66c815348fd3"},{"resourceInstanceName":"protected_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"},{"resourceInstanceName":"abstract_vsn","resourceName":"vFirewall-nodes.vsnCvfc","resourceInvariantUUID":"74805001-19f5-4c2c-9928-03014161c32a","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"d6a5add1-162a-4966-80a6-8ba53d83b17f"}],"artifacts":[{"artifactName":"vf-license-model.xml","artifactType":"VF_LICENSE","artifactURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/artifacts/6e816af9-944d-46d0-826d-5ff7be063a01","artifactDescription":"VF license file","artifactChecksum":"Njg4NTI4ZWY2MTliMGQzOGZmNDA4ZjRiMjllZmJkMzM=","artifactUUID":"6e816af9-944d-46d0-826d-5ff7be063a01","artifactVersion":"1","artifactLabel":"vflicense","artifactGroupType":"DEPLOYMENT"},{"artifactName":"base_vfw.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/artifacts/cbc75b18-86d1-4139-95f2-1d91f79a8b25","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"M2I1YmVjNzZkY2MxMWJkYTM5NzA3NDVhMGQxMzY2MDA=","artifactUUID":"cbc75b18-86d1-4139-95f2-1d91f79a8b25","artifactVersion":"2","artifactLabel":"heat1","artifactGroupType":"DEPLOYMENT"},{"artifactName":"vendor-license-model.xml","artifactType":"VENDOR_LICENSE","artifactURL":"/sdc/v1/catalog/resources/98c27d0b-9395-4f8b-87ab-e076cd1f627e/artifacts/5b592087-76bf-4c43-a1e7-d4151ce51cdd","artifactDescription":" Vendor license file","artifactChecksum":"Mjc0NGViYzYyNWZkZTRmYWFkYmUzZjY1MmEwNzRjZDE=","artifactUUID":"5b592087-76bf-4c43-a1e7-d4151ce51cdd","artifactVersion":"1","artifactLabel":"vendorlicense","artifactGroupType":"DEPLOYMENT"}],"description":"vFW, vSink"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/metadata/.file index ea376775e..7f8d22015 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/metadata/.file @@ -1 +1 @@ -{"uuid":"a004b0d8-54bd-4ede-9311-c75dc608e9fd","invariantUUID":"023a3f0d-1161-45ff-b4cf-8918a8ccf3ad","name":"vPacketGen","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/toscaModel","category":"Application L4+","subCategory":"Web Server","resourceType":"VF","lifecycleState":"CERTIFIED","lastUpdaterUserId":"jm0007","lastUpdaterFullName":"Joni Mitchell","toscaResourceName":"org.openecomp.resource.vf.Vpacketgen","resources":[{"resourceInstanceName":"abstract_vpg","resourceName":"vPacketGen-nodes.vpgCvfc","resourceInvariantUUID":"28142b9a-7925-4921-bc81-178c5bae4a9b","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"2bbcbcce-f9e2-4f5d-b975-1f1122d3226c"}],"artifacts":[{"artifactName":"vf-license-model.xml","artifactType":"VF_LICENSE","artifactURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/artifacts/0d837657-c5fe-4042-a105-b650361cc289","artifactDescription":"VF license file","artifactChecksum":"MGU5YWY1NzNmZmM3MTEwYmM0YTgzMmQ5NGUyMmUzODQ=","artifactUUID":"0d837657-c5fe-4042-a105-b650361cc289","artifactVersion":"1","artifactLabel":"vflicense","artifactGroupType":"DEPLOYMENT"},{"artifactName":"base_vpkg.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/artifacts/010c5015-477d-4aba-a57a-540daa1b7af6","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"NzI1ZTM5NDU3ZjBhMzQwNmFiNDYzNDBhOWM2NjNmOWU=","artifactUUID":"010c5015-477d-4aba-a57a-540daa1b7af6","artifactVersion":"2","artifactLabel":"heat1","artifactGroupType":"DEPLOYMENT"},{"artifactName":"vendor-license-model.xml","artifactType":"VENDOR_LICENSE","artifactURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/artifacts/054e473f-173b-48d5-a4ee-f5ef055c008d","artifactDescription":" Vendor license file","artifactChecksum":"Mjc0NGViYzYyNWZkZTRmYWFkYmUzZjY1MmEwNzRjZDE=","artifactUUID":"054e473f-173b-48d5-a4ee-f5ef055c008d","artifactVersion":"1","artifactLabel":"vendorlicense","artifactGroupType":"DEPLOYMENT"}],"description":"vPacketGen"}
\ No newline at end of file +{"uuid":"a004b0d8-54bd-4ede-9311-c75dc608e9fd","invariantUUID":"023a3f0d-1161-45ff-b4cf-8918a8ccf3ad","name":"vPacketGen","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/toscaModel","category":"Application L4+","subCategory":"Web Server","resourceType":"VF","lifecycleState":"CERTIFIED","lastUpdaterUserId":"jm0007","lastUpdaterFullName":"Joni Mitchell","toscaResourceName":"org.onap.resource.vf.Vpacketgen","resources":[{"resourceInstanceName":"abstract_vpg","resourceName":"vPacketGen-nodes.vpgCvfc","resourceInvariantUUID":"28142b9a-7925-4921-bc81-178c5bae4a9b","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"2bbcbcce-f9e2-4f5d-b975-1f1122d3226c"}],"artifacts":[{"artifactName":"vf-license-model.xml","artifactType":"VF_LICENSE","artifactURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/artifacts/0d837657-c5fe-4042-a105-b650361cc289","artifactDescription":"VF license file","artifactChecksum":"MGU5YWY1NzNmZmM3MTEwYmM0YTgzMmQ5NGUyMmUzODQ=","artifactUUID":"0d837657-c5fe-4042-a105-b650361cc289","artifactVersion":"1","artifactLabel":"vflicense","artifactGroupType":"DEPLOYMENT"},{"artifactName":"base_vpkg.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/artifacts/010c5015-477d-4aba-a57a-540daa1b7af6","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"NzI1ZTM5NDU3ZjBhMzQwNmFiNDYzNDBhOWM2NjNmOWU=","artifactUUID":"010c5015-477d-4aba-a57a-540daa1b7af6","artifactVersion":"2","artifactLabel":"heat1","artifactGroupType":"DEPLOYMENT"},{"artifactName":"vendor-license-model.xml","artifactType":"VENDOR_LICENSE","artifactURL":"/sdc/v1/catalog/resources/a004b0d8-54bd-4ede-9311-c75dc608e9fd/artifacts/054e473f-173b-48d5-a4ee-f5ef055c008d","artifactDescription":" Vendor license file","artifactChecksum":"Mjc0NGViYzYyNWZkZTRmYWFkYmUzZjY1MmEwNzRjZDE=","artifactUUID":"054e473f-173b-48d5-a4ee-f5ef055c008d","artifactVersion":"1","artifactLabel":"vendorlicense","artifactGroupType":"DEPLOYMENT"}],"description":"vPacketGen"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a01ebd00-4b64-4607-8422-c3733735800d/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a01ebd00-4b64-4607-8422-c3733735800d/metadata/.file index b2e0716c0..c48a50631 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a01ebd00-4b64-4607-8422-c3733735800d/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/a01ebd00-4b64-4607-8422-c3733735800d/metadata/.file @@ -1 +1 @@ -{"uuid":"a01ebd00-4b64-4607-8422-c3733735800d","invariantUUID":"dd6edb9e-015e-45ae-9597-bac06687f9e3","name":"vLoadBalancer-nodes.vdnsCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/a01ebd00-4b64-4607-8422-c3733735800d/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vloadbalancercvfc.abstract.nodes.vdns","resources":[{"resourceInstanceName":"vdns","resourceName":"Vloadbalancer.nodes.heat.vdns","resourceInvariantUUID":"b4ad5952-aa22-4645-ac57-72d55c8833be","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"cca286e8-5ac0-451c-b874-8cc307181e10"},{"resourceInstanceName":"vdns_vdns_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vdns_vdns_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file +{"uuid":"a01ebd00-4b64-4607-8422-c3733735800d","invariantUUID":"dd6edb9e-015e-45ae-9597-bac06687f9e3","name":"vLoadBalancer-nodes.vdnsCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/a01ebd00-4b64-4607-8422-c3733735800d/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vloadbalancercvfc.abstract.nodes.vdns","resources":[{"resourceInstanceName":"vdns","resourceName":"Vloadbalancer.nodes.heat.vdns","resourceInvariantUUID":"b4ad5952-aa22-4645-ac57-72d55c8833be","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"cca286e8-5ac0-451c-b874-8cc307181e10"},{"resourceInstanceName":"vdns_vdns_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vdns_vdns_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/b339e576-e433-4be4-8a43-258f629c4e79/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/b339e576-e433-4be4-8a43-258f629c4e79/metadata/.file index 24da339a5..1156b1475 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/b339e576-e433-4be4-8a43-258f629c4e79/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/b339e576-e433-4be4-8a43-258f629c4e79/metadata/.file @@ -1 +1 @@ -{"uuid":"b339e576-e433-4be4-8a43-258f629c4e79","invariantUUID":"d66c0bce-d7e1-41ad-bdaf-468d442d0543","name":"Vfirewall.nodes.heat.vsn","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/b339e576-e433-4be4-8a43-258f629c4e79/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vfirewall.abstract.nodes.heat.vsn","description":"Not reusable inner VFC"}
\ No newline at end of file +{"uuid":"b339e576-e433-4be4-8a43-258f629c4e79","invariantUUID":"d66c0bce-d7e1-41ad-bdaf-468d442d0543","name":"Vfirewall.nodes.heat.vsn","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/b339e576-e433-4be4-8a43-258f629c4e79/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vfirewall.abstract.nodes.heat.vsn","description":"Not reusable inner VFC"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/metadata/.file index 4a23a0ec1..b754b913c 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/metadata/.file @@ -1 +1 @@ -{"uuid":"c041f64d-8d8f-4f89-906f-79dccc63e7f5","invariantUUID":"48504e0e-f3d3-411d-a52b-eda1b8fec073","name":"vLoadBalancer","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/toscaModel","category":"Application L4+","subCategory":"Load Balancer","resourceType":"VF","lifecycleState":"CERTIFIED","lastUpdaterUserId":"jm0007","lastUpdaterFullName":"Joni Mitchell","toscaResourceName":"org.openecomp.resource.vf.Vloadbalancer","resources":[{"resourceInstanceName":"abstract_vdns","resourceName":"vLoadBalancer-nodes.vdnsCvfc","resourceInvariantUUID":"dd6edb9e-015e-45ae-9597-bac06687f9e3","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"a01ebd00-4b64-4607-8422-c3733735800d"},{"resourceInstanceName":"vlb_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"},{"resourceInstanceName":"abstract_vlb","resourceName":"vLoadBalancer-nodes.vlbCvfc","resourceInvariantUUID":"ba4d4b5d-f861-4155-886b-b1cdba5e0957","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"228aac11-6e48-4412-afbf-327c5c3b04fb"},{"resourceInstanceName":"abstract_vpg","resourceName":"vLoadBalancer-nodes.vpgCvfc","resourceInvariantUUID":"702cbc3d-5669-426d-aba6-6ddf4d4a702b","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"948da0c9-536e-4688-85eb-d906fe7324b3"},{"resourceInstanceName":"abstract_vdns_1","resourceName":"vLoadBalancer-nodes.vdns_1Cvfc","resourceInvariantUUID":"2ef814e3-7c17-420c-bdba-e84e338cd991","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"38b62ebd-276a-48e8-948b-de76c81d6686"},{"resourceInstanceName":"pktgen_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"}],"artifacts":[{"artifactName":"vf-license-model.xml","artifactType":"VF_LICENSE","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/51af0540-4863-4900-b3be-0f81abd89194","artifactDescription":"VF license file","artifactChecksum":"ODk5M2NiYzE2ZDk1ZmNkZmRjZDcwMTE1NjExMzViNjA=","artifactUUID":"51af0540-4863-4900-b3be-0f81abd89194","artifactVersion":"1","artifactLabel":"vflicense","artifactGroupType":"DEPLOYMENT"},{"artifactName":"dnsscaling.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/f5aad388-38b2-4b53-9df7-d8a25595e5cb","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"NmE1MmVmNThmZmFjZmZiZTA4NDY2NzA2OTM4ZmFlMGM=","artifactUUID":"f5aad388-38b2-4b53-9df7-d8a25595e5cb","artifactVersion":"2","artifactLabel":"heat1","artifactGroupType":"DEPLOYMENT"},{"artifactName":"base_vlb.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/3370c5c2-cdbc-45b9-ab76-1f0d45cda59e","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"ZWZiMDg0M2UxMGZmMjlhYTIxODE5ZDBhNWVhZDk2NTU=","artifactUUID":"3370c5c2-cdbc-45b9-ab76-1f0d45cda59e","artifactVersion":"2","artifactLabel":"heat2","artifactGroupType":"DEPLOYMENT"},{"artifactName":"vendor-license-model.xml","artifactType":"VENDOR_LICENSE","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/28a877c8-2005-43d7-802d-769b5f420608","artifactDescription":" Vendor license file","artifactChecksum":"Mjc0NGViYzYyNWZkZTRmYWFkYmUzZjY1MmEwNzRjZDE=","artifactUUID":"28a877c8-2005-43d7-802d-769b5f420608","artifactVersion":"1","artifactLabel":"vendorlicense","artifactGroupType":"DEPLOYMENT"}],"description":"vLB, vDNS, vPacketGen"}
\ No newline at end of file +{"uuid":"c041f64d-8d8f-4f89-906f-79dccc63e7f5","invariantUUID":"48504e0e-f3d3-411d-a52b-eda1b8fec073","name":"vLoadBalancer","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/toscaModel","category":"Application L4+","subCategory":"Load Balancer","resourceType":"VF","lifecycleState":"CERTIFIED","lastUpdaterUserId":"jm0007","lastUpdaterFullName":"Joni Mitchell","toscaResourceName":"org.onap.resource.vf.Vloadbalancer","resources":[{"resourceInstanceName":"abstract_vdns","resourceName":"vLoadBalancer-nodes.vdnsCvfc","resourceInvariantUUID":"dd6edb9e-015e-45ae-9597-bac06687f9e3","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"a01ebd00-4b64-4607-8422-c3733735800d"},{"resourceInstanceName":"vlb_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"},{"resourceInstanceName":"abstract_vlb","resourceName":"vLoadBalancer-nodes.vlbCvfc","resourceInvariantUUID":"ba4d4b5d-f861-4155-886b-b1cdba5e0957","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"228aac11-6e48-4412-afbf-327c5c3b04fb"},{"resourceInstanceName":"abstract_vpg","resourceName":"vLoadBalancer-nodes.vpgCvfc","resourceInvariantUUID":"702cbc3d-5669-426d-aba6-6ddf4d4a702b","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"948da0c9-536e-4688-85eb-d906fe7324b3"},{"resourceInstanceName":"abstract_vdns_1","resourceName":"vLoadBalancer-nodes.vdns_1Cvfc","resourceInvariantUUID":"2ef814e3-7c17-420c-bdba-e84e338cd991","resourceVersion":"1.0","resoucreType":"CVFC","resourceUUID":"38b62ebd-276a-48e8-948b-de76c81d6686"},{"resourceInstanceName":"pktgen_private_network","resourceName":"NeutronNet","resourceInvariantUUID":"e83f8487-8ba2-479c-8d63-23217595dbb2","resourceVersion":"1.0","resoucreType":"VL","resourceUUID":"fc80335e-39cf-44a3-8860-995495fad829"}],"artifacts":[{"artifactName":"vf-license-model.xml","artifactType":"VF_LICENSE","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/51af0540-4863-4900-b3be-0f81abd89194","artifactDescription":"VF license file","artifactChecksum":"ODk5M2NiYzE2ZDk1ZmNkZmRjZDcwMTE1NjExMzViNjA=","artifactUUID":"51af0540-4863-4900-b3be-0f81abd89194","artifactVersion":"1","artifactLabel":"vflicense","artifactGroupType":"DEPLOYMENT"},{"artifactName":"dnsscaling.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/f5aad388-38b2-4b53-9df7-d8a25595e5cb","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"NmE1MmVmNThmZmFjZmZiZTA4NDY2NzA2OTM4ZmFlMGM=","artifactUUID":"f5aad388-38b2-4b53-9df7-d8a25595e5cb","artifactVersion":"2","artifactLabel":"heat1","artifactGroupType":"DEPLOYMENT"},{"artifactName":"base_vlb.yaml","artifactType":"HEAT","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/3370c5c2-cdbc-45b9-ab76-1f0d45cda59e","artifactDescription":"created from csar","artifactTimeout":60,"artifactChecksum":"ZWZiMDg0M2UxMGZmMjlhYTIxODE5ZDBhNWVhZDk2NTU=","artifactUUID":"3370c5c2-cdbc-45b9-ab76-1f0d45cda59e","artifactVersion":"2","artifactLabel":"heat2","artifactGroupType":"DEPLOYMENT"},{"artifactName":"vendor-license-model.xml","artifactType":"VENDOR_LICENSE","artifactURL":"/sdc/v1/catalog/resources/c041f64d-8d8f-4f89-906f-79dccc63e7f5/artifacts/28a877c8-2005-43d7-802d-769b5f420608","artifactDescription":" Vendor license file","artifactChecksum":"Mjc0NGViYzYyNWZkZTRmYWFkYmUzZjY1MmEwNzRjZDE=","artifactUUID":"28a877c8-2005-43d7-802d-769b5f420608","artifactVersion":"1","artifactLabel":"vendorlicense","artifactGroupType":"DEPLOYMENT"}],"description":"vLB, vDNS, vPacketGen"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c8a01686-2762-483c-98ad-a66606b9947f/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c8a01686-2762-483c-98ad-a66606b9947f/metadata/.file index ecf6aa73a..24fbb4740 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c8a01686-2762-483c-98ad-a66606b9947f/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/c8a01686-2762-483c-98ad-a66606b9947f/metadata/.file @@ -1 +1 @@ -{"uuid":"c8a01686-2762-483c-98ad-a66606b9947f","invariantUUID":"86769df9-139b-489f-949d-05efb7f0ed6a","name":"Vpacketgen.nodes.heat.vpg","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/c8a01686-2762-483c-98ad-a66606b9947f/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vpacketgen.abstract.nodes.heat.vpg","description":"Not reusable inner VFC"}
\ No newline at end of file +{"uuid":"c8a01686-2762-483c-98ad-a66606b9947f","invariantUUID":"86769df9-139b-489f-949d-05efb7f0ed6a","name":"Vpacketgen.nodes.heat.vpg","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/c8a01686-2762-483c-98ad-a66606b9947f/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vpacketgen.abstract.nodes.heat.vpg","description":"Not reusable inner VFC"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/cca286e8-5ac0-451c-b874-8cc307181e10/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/cca286e8-5ac0-451c-b874-8cc307181e10/metadata/.file index 58b5d3673..40093178f 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/cca286e8-5ac0-451c-b874-8cc307181e10/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/cca286e8-5ac0-451c-b874-8cc307181e10/metadata/.file @@ -1 +1 @@ -{"uuid":"cca286e8-5ac0-451c-b874-8cc307181e10","invariantUUID":"b4ad5952-aa22-4645-ac57-72d55c8833be","name":"Vloadbalancer.nodes.heat.vdns","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/cca286e8-5ac0-451c-b874-8cc307181e10/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vloadbalancer.abstract.nodes.heat.vdns","description":"Not reusable inner VFC"}
\ No newline at end of file +{"uuid":"cca286e8-5ac0-451c-b874-8cc307181e10","invariantUUID":"b4ad5952-aa22-4645-ac57-72d55c8833be","name":"Vloadbalancer.nodes.heat.vdns","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/cca286e8-5ac0-451c-b874-8cc307181e10/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vloadbalancer.abstract.nodes.heat.vdns","description":"Not reusable inner VFC"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/d6a5add1-162a-4966-80a6-8ba53d83b17f/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/d6a5add1-162a-4966-80a6-8ba53d83b17f/metadata/.file index 8038b8130..7ccde1490 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/d6a5add1-162a-4966-80a6-8ba53d83b17f/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/d6a5add1-162a-4966-80a6-8ba53d83b17f/metadata/.file @@ -1 +1 @@ -{"uuid":"d6a5add1-162a-4966-80a6-8ba53d83b17f","invariantUUID":"74805001-19f5-4c2c-9928-03014161c32a","name":"vFirewall-nodes.vsnCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/d6a5add1-162a-4966-80a6-8ba53d83b17f/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vfirewallcvfc.abstract.nodes.vsn","resources":[{"resourceInstanceName":"vsn","resourceName":"Vfirewall.nodes.heat.vsn","resourceInvariantUUID":"d66c0bce-d7e1-41ad-bdaf-468d442d0543","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"b339e576-e433-4be4-8a43-258f629c4e79"},{"resourceInstanceName":"vsn_vsn_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vsn_vsn_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file +{"uuid":"d6a5add1-162a-4966-80a6-8ba53d83b17f","invariantUUID":"74805001-19f5-4c2c-9928-03014161c32a","name":"vFirewall-nodes.vsnCvfc","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/d6a5add1-162a-4966-80a6-8ba53d83b17f/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"CVFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vfirewallcvfc.abstract.nodes.vsn","resources":[{"resourceInstanceName":"vsn","resourceName":"Vfirewall.nodes.heat.vsn","resourceInvariantUUID":"d66c0bce-d7e1-41ad-bdaf-468d442d0543","resourceVersion":"1.0","resoucreType":"VFC","resourceUUID":"b339e576-e433-4be4-8a43-258f629c4e79"},{"resourceInstanceName":"vsn_vsn_private_1_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"},{"resourceInstanceName":"vsn_vsn_private_0_port","resourceName":"NeutronPort","resourceInvariantUUID":"d8a13756-4f96-40e2-a1ab-108dcda821a9","resourceVersion":"1.0","resoucreType":"CP","resourceUUID":"3a8362d1-b072-4cd1-b55c-73d882c8a388"}],"description":"Complex node type that is used as nested type in VF"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d/metadata/.file b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d/metadata/.file index 777738301..3113104e1 100644 --- a/src/test/resources/http-cache/example/sdc/v1/catalog/resources/f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d/metadata/.file +++ b/src/test/resources/http-cache/example/sdc/v1/catalog/resources/f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d/metadata/.file @@ -1 +1 @@ -{"uuid":"f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d","invariantUUID":"3ff44c1d-0384-4501-8e33-dd3000799378","name":"Vloadbalancer.nodes.heat.vlb","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.openecomp.resource.vfc.Vloadbalancer.abstract.nodes.heat.vlb","description":"Not reusable inner VFC"}
\ No newline at end of file +{"uuid":"f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d","invariantUUID":"3ff44c1d-0384-4501-8e33-dd3000799378","name":"Vloadbalancer.nodes.heat.vlb","version":"1.0","toscaModelURL":"/sdc/v1/catalog/resources/f2686c0f-11c5-4cab-83bd-b0f2cc35bf4d/toscaModel","category":"Generic","subCategory":"Abstract","resourceType":"VFC","lifecycleState":"CERTIFIED","lastUpdaterUserId":"cs0008","lastUpdaterFullName":"Carlos Santana","toscaResourceName":"org.onap.resource.vfc.Vloadbalancer.abstract.nodes.heat.vlb","description":"Not reusable inner VFC"}
\ No newline at end of file diff --git a/src/test/resources/http-cache/start_http_cache.sh b/src/test/resources/http-cache/start_http_cache.sh index a8ff96ac1..178ac80af 100755 --- a/src/test/resources/http-cache/start_http_cache.sh +++ b/src/test/resources/http-cache/start_http_cache.sh @@ -49,4 +49,4 @@ done echo 'Installing requests packages for Python' pip install requests echo 'Executing the Http proxy in Cache mode only' -python third_party_proxy.py --port 8080 --root /usr/src/http-cache-app/data-cache $python_proxyaddress +python -u third_party_proxy.py --port 8080 --root /usr/src/http-cache-app/data-cache $python_proxyaddress diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py index fdc4fab34..30f510752 100755 --- a/src/test/resources/http-cache/third_party_proxy.py +++ b/src/test/resources/http-cache/third_party_proxy.py @@ -25,6 +25,7 @@ import json import requests import os +import errno import sys import SimpleHTTPServer import SocketServer @@ -37,7 +38,8 @@ import shutil parser = argparse.ArgumentParser(description="3rd party Cache & Replay") parser.add_argument("--username", "-u", type=str, help="Set the username for contacting 3rd party - only used for GET") parser.add_argument("--password", "-p", type=str, help="Set the password for contacting 3rd party - only used for GET") -parser.add_argument("--root", "-r", default=tempfile.mkdtemp, type=str, help="Root folder for the proxy cache") +parser.add_argument("--root", "-r", default=tempfile.mkdtemp(), type=str, help="Root folder for the proxy cache") +parser.add_argument("--temp", "-t", default=tempfile.mkdtemp(), type=str, help="Temp folder for the generated content") parser.add_argument("--proxy" , type=str, help="Url of the Act as a proxy. If not set, this script only uses the cache and will return a 404 if files aren't found") parser.add_argument("--port", "-P", type=int, default="8081", help="Port on which the proxy should listen to") parser.add_argument("--verbose", "-v", type=bool, help="Print more information in case of error") @@ -49,8 +51,9 @@ PORT = options.port HOST = options.proxy AUTH = (options.username, options.password) HEADERS = {'X-ECOMP-InstanceID':'CLAMP'} -CACHE_ROOT = options.root -PROXY_ADDRESS=options.proxyaddress +CACHE_ROOT = str(options.root) +TMP_ROOT = str(options.temp) +PROXY_ADDRESS=str(options.proxyaddress) def signal_handler(signal_sent, frame): global httpd @@ -61,7 +64,6 @@ def signal_handler(signal_sent, frame): httpd.server_close() class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): - def print_headers(self): for header,value in self.headers.items(): print("header: %s : %s" % (header, value)) @@ -82,238 +84,296 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): fc = f.read() self.wfile.write(fc) - def _write_cache(self,cached_file, header_file, content_file, response): - os.makedirs(cached_file, True) + def _write_cache(self,cached_file_folder, header_file, content_file, response): + os.makedirs(cached_file_folder, 0777) with open(content_file, 'w') as f: f.write(response.raw.read()) with open(header_file, 'w') as f: json.dump(dict(response.raw.headers), f) # Entry point of the code + def _get_cached_file_folder_name(self,folder): + cached_file_folder = '%s/%s' % (folder, self.path,) + print("Cached file name before escaping : %s" % cached_file_folder) + cached_file_folder = cached_file_folder.replace('<','<').replace('>','>').replace('?','?').replace('*','*').replace('\\','*').replace(':',':').replace('|','|') + print("Cached file name after escaping (used for cache storage) : %s" % cached_file_folder) + return cached_file_folder + + def _get_cached_content_file_name(self,cached_file_folder): + return "%s/.file" % (cached_file_folder,) + + def _get_cached_header_file_name(self,cached_file_folder): + return "%s/.header" % (cached_file_folder,) + + def _execute_content_generated_cases(self,http_type): + print("Testing special cases, cache files will be sent to :" +TMP_ROOT) + cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) + _file_available = os.path.exists(cached_file_content) + + if self.path.startswith("/dcae-service-types?asdcResourceId=") and http_type == "GET": + if not _file_available: + print "self.path start with /dcae-service-types?asdcResourceId=, generating response json..." + uuidGenerated = str(uuid.uuid4()) + typeId = "typeId-" + uuidGenerated + typeName = "typeName-" + uuidGenerated + print "typeId generated: " + typeName + " and typeName: "+ typeId + jsonGenerated = "{\"totalCount\":1, \"items\":[{\"typeId\":\"" + typeId + "\", \"typeName\":\"" + typeName +"\"}]}" + print "jsonGenerated: " + jsonGenerated + + os.makedirs(cached_file_folder, 0777) + with open(cached_file_header, 'w') as f: + f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") + with open(cached_file_content, 'w') as f: + f.write(jsonGenerated) + return True + elif self.path.startswith("/dcae-operationstatus") and http_type == "GET": + if not _file_available: + print "self.path start with /dcae-operationstatus, generating response json..." + jsonGenerated = "{\"operationType\": \"operationType1\", \"status\": \"succeeded\"}" + print "jsonGenerated: " + jsonGenerated + + try: + os.makedirs(cached_file_folder, 0777) + except OSError as e: + if e.errno != errno.EEXIST: + raise + print(cached_file_folder+" already exists") + + with open(cached_file_header, 'w') as f: + f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") + with open(cached_file_content, 'w') as f: + f.write(jsonGenerated) + return True + elif self.path.startswith("/sdc/v1/catalog/services/") and http_type == "POST": + if not _file_available: + print "self.path start with /sdc/v1/catalog/services/, generating response json..." + jsondata = json.loads(self.data_string) + jsonGenerated = "{\"artifactName\":\"" + jsondata['artifactName'] + "\",\"artifactType\":\"" + jsondata['artifactType'] + "\",\"artifactURL\":\"" + self.path + "\",\"artifactDescription\":\"" + jsondata['description'] + "\",\"artifactChecksum\":\"ZjJlMjVmMWE2M2M1OTM2MDZlODlmNTVmZmYzNjViYzM=\",\"artifactUUID\":\"" + str(uuid.uuid4()) + "\",\"artifactVersion\":\"1\"}" + print "jsonGenerated: " + jsonGenerated + + os.makedirs(cached_file_folder, 0777) + with open(cached_file_header, 'w') as f: + f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") + with open(cached_file_content, 'w') as f: + f.write(jsonGenerated) + return True; + elif self.path.startswith("/dcae-deployments/") and (http_type == "PUT" or http_type == "DELETE"): + if not _file_available: + print "self.path start with /dcae-deployments/, generating response json..." + #jsondata = json.loads(self.data_string) + jsonGenerated = "{\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus\",\"test2\":\"test2\"}}" + print "jsonGenerated: " + jsonGenerated + + os.makedirs(cached_file_folder, 0777) + with open(cached_file_header, 'w') as f: + f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") + with open(cached_file_content, 'w') as f: + f.write(jsonGenerated) + return True + elif (self.path.startswith("/pdp/api/") and http_type == "PUT" or http_type == "DELETE") or (self.path.startswith("/pdp/api/policyEngineImport") and http_type == "POST"): + print "self.path start with /pdp/api/, copying body to response ..." + if not os.path.exists(cached_file_folder): + os.makedirs(cached_file_folder, 0777) + with open(cached_file_header, 'w+') as f: + f.write("{\"Content-Length\": \"" + str(len(self.data_string)) + "\", \"Content-Type\": \""+str(self.headers['Content-Type'])+"\"}") + with open(cached_file_content, 'w+') as f: + f.write(self.data_string) + return True + else: + return False + + def do_GET(self): + cached_file_folder = "" + cached_file_content ="" + cached_file_header="" print("\n\n\nGot a GET request for %s " % self.path) self.print_headers() self.check_credentials() - - cached_file = '%s/%s' % (CACHE_ROOT, self.path,) - print("Cached file name before escaping : %s" % cached_file) - cached_file = cached_file.replace('<','<').replace('>','>').replace('?','?').replace('*','*').replace('\\','*').replace(':',':').replace('|','|') - print("Cached file name after escaping (used for cache storage) : %s" % cached_file) - cached_file_content = "%s/.file" % (cached_file,) - cached_file_header = "%s/.header" % (cached_file,) + # Verify if it's a special case + is_special = self._execute_content_generated_cases("GET") + if is_special: + cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) + else: + cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) _file_available = os.path.exists(cached_file_content) if not _file_available: - print("Request for data currently not present in cache: %s" % (cached_file,)) - - if self.path.startswith("/dcae-service-types?asdcResourceId="): - print "self.path start with /dcae-service-types?asdcResourceId=, generating response json..." - uuidGenerated = str(uuid.uuid4()) - typeId = "typeId-" + uuidGenerated - typeName = "typeName-" + uuidGenerated - print "typeId generated: " + typeName + " and typeName: "+ typeId - jsonGenerated = "{\"totalCount\":1, \"items\":[{\"typeId\":\"" + typeId + "\", \"typeName\":\"" + typeName +"\"}]}" - print "jsonGenerated: " + jsonGenerated - - os.makedirs(cached_file, True) - with open(cached_file_header, 'w') as f: - f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") - with open(cached_file_content, 'w') as f: - f.write(jsonGenerated) - elif self.path.startswith("/dcae-operationstatus"): - print "self.path start with /dcae-operationstatus, generating response json..." - jsonGenerated = "{\"operationType\": \"operationType1\", \"status\": \"succeeded\"}" - print "jsonGenerated: " + jsonGenerated - - os.makedirs(cached_file, True) - with open(cached_file_header, 'w') as f: - f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") - with open(cached_file_content, 'w') as f: - f.write(jsonGenerated) + print("Request for data currently not present in cache: %s" % (cached_file_folder,)) + + if not HOST: + self.send_response(404) + return "404 Not found" + + url = '%s%s' % (HOST, self.path) + response = requests.get(url, auth=AUTH, headers=HEADERS, stream=True) + + if response.status_code == 200: + self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response) else: - if not HOST: - self.send_response(404) - return "404 Not found" - - url = '%s%s' % (HOST, self.path) - response = requests.get(url, auth=AUTH, headers=HEADERS, stream=True) - - if response.status_code == 200: - self._write_cache(cached_file, cached_file_header, cached_file_content, response) - else: - print('Error when requesting file :') - print('Requested url : %s' % (url,)) - print('Status code : %s' % (response.status_code,)) - print('Content : %s' % (response.content,)) - self.send_response(response.status_code) - return response.content + print('Error when requesting file :') + print('Requested url : %s' % (url,)) + print('Status code : %s' % (response.status_code,)) + print('Content : %s' % (response.content,)) + self.send_response(response.status_code) + return response.content else: - print("Request for data currently present in cache: %s" % (cached_file,)) + print("Request for data currently present in cache: %s" % (cached_file_folder,)) self._send_content(cached_file_header, cached_file_content) if self.path.startswith("/dcae-service-types?asdcResourceId="): - print "DCAE case deleting folder created " + cached_file - shutil.rmtree(cached_file, ignore_errors=False, onerror=None) + print "DCAE case deleting folder created " + cached_file_folder + shutil.rmtree(cached_file_folder, ignore_errors=False, onerror=None) else: - print "NOT in DCAE case deleting folder created " + cached_file + print "NOT in DCAE case deleting folder created " + cached_file_folder def do_POST(self): + cached_file_folder = "" + cached_file_content ="" + cached_file_header="" print("\n\n\nGot a POST for %s" % self.path) self.check_credentials() self.data_string = self.rfile.read(int(self.headers['Content-Length'])) print("data-string:\n %s" % self.data_string) print("self.headers:\n %s" % self.headers) - cached_file = '%s/%s' % (CACHE_ROOT, self.path,) - print("Cached file name before escaping : %s" % cached_file) - cached_file = cached_file.replace('<','<').replace('>','>').replace('?','?').replace('*','*').replace('\\','*').replace(':',':').replace('|','|') - print("Cached file name after escaping (used for cache storage) : %s" % cached_file) - cached_file_content = "%s/.file" % (cached_file,) - cached_file_header = "%s/.header" % (cached_file,) + is_special = self._execute_content_generated_cases("POST") + if is_special: + cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) + else: + cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) _file_available = os.path.exists(cached_file_content) if not _file_available: - if self.path.startswith("/sdc/v1/catalog/services/"): - print "self.path start with /sdc/v1/catalog/services/, generating response json..." - jsondata = json.loads(self.data_string) - jsonGenerated = "{\"artifactName\":\"" + jsondata['artifactName'] + "\",\"artifactType\":\"" + jsondata['artifactType'] + "\",\"artifactURL\":\"" + self.path + "\",\"artifactDescription\":\"" + jsondata['description'] + "\",\"artifactChecksum\":\"ZjJlMjVmMWE2M2M1OTM2MDZlODlmNTVmZmYzNjViYzM=\",\"artifactUUID\":\"" + str(uuid.uuid4()) + "\",\"artifactVersion\":\"1\"}" - print "jsonGenerated: " + jsonGenerated - - os.makedirs(cached_file, True) - with open(cached_file_header, 'w') as f: - f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") - with open(cached_file_content, 'w') as f: - f.write(jsonGenerated) + + if not HOST: + self.send_response(404) + return "404 Not found" + + print("Request for data currently not present in cache: %s" % (cached_file_folder,)) + + url = '%s%s' % (HOST, self.path) + print("url: %s" % (url,)) + response = requests.post(url, data=self.data_string, headers=self.headers, stream=True) + + if response.status_code == 200: + self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response) else: - if not HOST: - self.send_response(404) - return "404 Not found" - - print("Request for data currently not present in cache: %s" % (cached_file,)) - - url = '%s%s' % (HOST, self.path) - print("url: %s" % (url,)) - response = requests.post(url, data=self.data_string, headers=self.headers, stream=True) - - if response.status_code == 200: - self._write_cache(cached_file, cached_file_header, cached_file_content, response) - else: - print('Error when requesting file :') - print('Requested url : %s' % (url,)) - print('Status code : %s' % (response.status_code,)) - print('Content : %s' % (response.content,)) - self.send_response(response.status_code) - return response.content + print('Error when requesting file :') + print('Requested url : %s' % (url,)) + print('Status code : %s' % (response.status_code,)) + print('Content : %s' % (response.content,)) + self.send_response(response.status_code) + return response.content else: - print("Request for data present in cache: %s" % (cached_file,)) + print("Request for data present in cache: %s" % (cached_file_folder,)) self._send_content(cached_file_header, cached_file_content) def do_PUT(self): + cached_file_folder = "" + cached_file_content ="" + cached_file_header="" print("\n\n\nGot a PUT for %s " % self.path) self.check_credentials() self.data_string = self.rfile.read(int(self.headers['Content-Length'])) print("data-string:\n %s" % self.data_string) print("self.headers:\n %s" % self.headers) - cached_file = '%s/%s' % (CACHE_ROOT, self.path,) - print("Cached file name before escaping : %s" % cached_file) - cached_file = cached_file.replace('<','<').replace('>','>').replace('?','?').replace('*','*').replace('\\','*').replace(':',':').replace('|','|') - print("Cached file name after escaping (used for cache storage) : %s" % cached_file) - cached_file_content = "%s/.file" % (cached_file,) - cached_file_header = "%s/.header" % (cached_file,) + is_special = self._execute_content_generated_cases("PUT") + if is_special: + cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) + else: + cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) _file_available = os.path.exists(cached_file_content) if not _file_available: - if self.path.startswith("/dcae-deployments/"): - print "self.path start with /dcae-deployments/, generating response json..." - #jsondata = json.loads(self.data_string) - jsonGenerated = "{\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus\",\"test2\":\"test2\"}}" - print "jsonGenerated: " + jsonGenerated - - os.makedirs(cached_file, True) - with open(cached_file_header, 'w') as f: - f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") - with open(cached_file_content, 'w') as f: - f.write(jsonGenerated) + if not HOST: + self.send_response(404) + return "404 Not found" + + print("Request for data currently not present in cache: %s" % (cached_file_folder,)) + + url = '%s%s' % (HOST, self.path) + print("url: %s" % (url,)) + response = requests.put(url, data=self.data_string, headers=self.headers, stream=True) + + if response.status_code == 200: + self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response) else: - if not HOST: - self.send_response(404) - return "404 Not found" - - print("Request for data currently not present in cache: %s" % (cached_file,)) - - url = '%s%s' % (HOST, self.path) - print("url: %s" % (url,)) - response = requests.put(url, data=self.data_string, headers=self.headers, stream=True) - - if response.status_code == 200: - self._write_cache(cached_file, cached_file_header, cached_file_content, response) - else: - print('Error when requesting file :') - print('Requested url : %s' % (url,)) - print('Status code : %s' % (response.status_code,)) - print('Content : %s' % (response.content,)) - self.send_response(response.status_code) - return response.content + print('Error when requesting file :') + print('Requested url : %s' % (url,)) + print('Status code : %s' % (response.status_code,)) + print('Content : %s' % (response.content,)) + self.send_response(response.status_code) + return response.content else: - print("Request for data present in cache: %s" % (cached_file,)) + print("Request for data present in cache: %s" % (cached_file_folder,)) self._send_content(cached_file_header, cached_file_content) def do_DELETE(self): + cached_file_folder = "" + cached_file_content ="" + cached_file_header="" print("\n\n\nGot a DELETE for %s " % self.path) self.check_credentials() + self.data_string = self.rfile.read(int(self.headers['Content-Length'])) print("self.headers:\n %s" % self.headers) - cached_file = '%s/%s' % (CACHE_ROOT, self.path,) - print("Cached file name before escaping : %s" % cached_file) - cached_file = cached_file.replace('<','<').replace('>','>').replace('?','?').replace('*','*').replace('\\','*').replace(':',':').replace('|','|') - print("Cached file name after escaping (used for cache storage) : %s" % cached_file) - cached_file_content = "%s/.file" % (cached_file,) - cached_file_header = "%s/.header" % (cached_file,) + is_special = self._execute_content_generated_cases("DELETE") + if is_special: + cached_file_folder = self._get_cached_file_folder_name(TMP_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) + else: + cached_file_folder = self._get_cached_file_folder_name(CACHE_ROOT) + cached_file_content = self._get_cached_content_file_name(cached_file_folder) + cached_file_header = self._get_cached_header_file_name(cached_file_folder) _file_available = os.path.exists(cached_file_content) if not _file_available: - if self.path.startswith("/dcae-deployments/"): - print "self.path start with /dcae-deployments/, generating response json..." - #jsondata = json.loads(self.data_string) - jsonGenerated = "{\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus\",\"test2\":\"test2\"}}" - print "jsonGenerated: " + jsonGenerated - - os.makedirs(cached_file, True) - with open(cached_file_header, 'w') as f: - f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}") - with open(cached_file_content, 'w') as f: - f.write(jsonGenerated) + if not HOST: + self.send_response(404) + return "404 Not found" + + print("Request for data currently not present in cache: %s" % (cached_file_folder,)) + + url = '%s%s' % (HOST, self.path) + print("url: %s" % (url,)) + response = requests.put(url, data=self.data_string, headers=self.headers, stream=True) + + if response.status_code == 200: + self._write_cache(cached_file_folder, cached_file_header, cached_file_content, response) else: - if not HOST: - self.send_response(404) - return "404 Not found" - - print("Request for data currently not present in cache: %s" % (cached_file,)) - - url = '%s%s' % (HOST, self.path) - print("url: %s" % (url,)) - response = requests.put(url, data=self.data_string, headers=self.headers, stream=True) - - if response.status_code == 200: - self._write_cache(cached_file, cached_file_header, cached_file_content, response) - else: - print('Error when requesting file :') - print('Requested url : %s' % (url,)) - print('Status code : %s' % (response.status_code,)) - print('Content : %s' % (response.content,)) - self.send_response(response.status_code) - return response.content + print('Error when requesting file :') + print('Requested url : %s' % (url,)) + print('Status code : %s' % (response.status_code,)) + print('Content : %s' % (response.content,)) + self.send_response(response.status_code) + return response.content else: - print("Request for data present in cache: %s" % (cached_file,)) + print("Request for data present in cache: %s" % (cached_file_folder,)) self._send_content(cached_file_header, cached_file_content) @@ -322,6 +382,7 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): # Main code that start the HTTP server httpd = SocketServer.ForkingTCPServer(('', PORT), Proxy) httpd.allow_reuse_address = True -print "Listening on port "+ str(PORT) + " and caching in " + CACHE_ROOT + "(Press Ctrl+C to stop HTTPD Caching script)" +print "Listening on port "+ str(PORT) + "(Press Ctrl+C/Ctrl+Z to stop HTTPD Caching script)" +print "Caching folder " + CACHE_ROOT + ", Tmp folder for generated files " + TMP_ROOT signal.signal(signal.SIGINT, signal_handler) httpd.serve_forever()
\ No newline at end of file diff --git a/src/test/resources/https/https-test.properties b/src/test/resources/https/https-test.properties index e15ea6edc..7614e1770 100644 --- a/src/test/resources/https/https-test.properties +++ b/src/test/resources/https/https-test.properties @@ -25,7 +25,7 @@ ### (See below for the parameter 'server.http.port' if you want to have both enabled) ### To have only HTTP, keep the lines server.ssl.* commented ### To have only HTTPS enabled, uncomment the server.ssl.* lines and specify a right keystore location -server.port=10443 +server.port=${clamp.it.tests.https} ### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port') server.ssl.key-store=classpath:https/keystore-test.jks server.ssl.key-store-password=testpass @@ -34,7 +34,7 @@ server.ssl.key-password=testpass ### In order to be user friendly when HTTPS is enabled, ### you can add another HTTP port that will be automatically redirected to HTTPS ### by enabling this parameter (server.http.port) and set it to another port (80 or 8080, 8090, etc ...) -server.http-to-https-redirection.port=10080 +server.http-to-https-redirection.port=${clamp.it.tests.http-redirected} ### HTTP Example: ###-------------- diff --git a/src/test/resources/tosca/tca-policy-test.yaml b/src/test/resources/tosca/tca-policy-test.yaml new file mode 100644 index 000000000..3c5afb01d --- /dev/null +++ b/src/test/resources/tosca/tca-policy-test.yaml @@ -0,0 +1,80 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + policy.nodes.cdap.tca.hi.lo.app: + derived_from: policy.nodes.Root + properties: + domain: + type: string + description: Domain + constraints: + - equal: measurementsForVfScaling + functionalRole: + type: string + description: Function of the event source e.g., vnf1, vnf2, vnf3 + thresholds: + type: list + description: Thresholds + entry_schema: + type: policy.data.thresholds +data_types: + policy.data.thresholds: + properties: + closedLoopControlName: + type: string + description: A UNIQUE string identifying the Closed Loop ID this event is for. + direction: + type: string + constraints: + - valid_values: [ LESS, LESS_OR_EQUAL, GREATER, GREATER_OR_EQUAL] + fieldPath: + description: Field Path + type: string + severity: + type: string + description: event severity or priority + constraints: + - valid_values: [CRITICAL, MAJOR, MINOR, WARNING, NORMAL] + thresholdValue: + type: integer + description: ThresholdValue + default: 0 + constraints: + - in_range: [ 0, 65535 ] + version: + type: string + description: Version for the closed loop message + constraints: + - min_length: 1 + dummySignatures: + type: list + description: dummy Signatures + required: true + entry_schema: + type: policy.data.dummySignatureTraversal + policy.data.dummySignatureTraversal: + derived_from: tosca.nodes.Root + properties: + signature: + type: policy.data.DUMMY_Signature_FM + required: true + traversal: + type: policy.data.traverse + required: true + policy.data.traverse: + derived_from: tosca.nodes.Root + properties: + traversal: + type: string + description: Dummy Traverse + required: true + constraints: + - valid_values: [ ONE, TWO, THREE ] + policy.data.DUMMY_Signature_FM: + derived_from: tosca.nodes.Root + properties: + filter_clause: + type: string + description: Filter Clause + required: true + constraints: + - valid_values: [ OR, AND, NOT ] diff --git a/src/test/resources/tosca/tosca_example.yaml b/src/test/resources/tosca/tosca_example.yaml new file mode 100644 index 000000000..3c5afb01d --- /dev/null +++ b/src/test/resources/tosca/tosca_example.yaml @@ -0,0 +1,80 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + policy.nodes.cdap.tca.hi.lo.app: + derived_from: policy.nodes.Root + properties: + domain: + type: string + description: Domain + constraints: + - equal: measurementsForVfScaling + functionalRole: + type: string + description: Function of the event source e.g., vnf1, vnf2, vnf3 + thresholds: + type: list + description: Thresholds + entry_schema: + type: policy.data.thresholds +data_types: + policy.data.thresholds: + properties: + closedLoopControlName: + type: string + description: A UNIQUE string identifying the Closed Loop ID this event is for. + direction: + type: string + constraints: + - valid_values: [ LESS, LESS_OR_EQUAL, GREATER, GREATER_OR_EQUAL] + fieldPath: + description: Field Path + type: string + severity: + type: string + description: event severity or priority + constraints: + - valid_values: [CRITICAL, MAJOR, MINOR, WARNING, NORMAL] + thresholdValue: + type: integer + description: ThresholdValue + default: 0 + constraints: + - in_range: [ 0, 65535 ] + version: + type: string + description: Version for the closed loop message + constraints: + - min_length: 1 + dummySignatures: + type: list + description: dummy Signatures + required: true + entry_schema: + type: policy.data.dummySignatureTraversal + policy.data.dummySignatureTraversal: + derived_from: tosca.nodes.Root + properties: + signature: + type: policy.data.DUMMY_Signature_FM + required: true + traversal: + type: policy.data.traverse + required: true + policy.data.traverse: + derived_from: tosca.nodes.Root + properties: + traversal: + type: string + description: Dummy Traverse + required: true + constraints: + - valid_values: [ ONE, TWO, THREE ] + policy.data.DUMMY_Signature_FM: + derived_from: tosca.nodes.Root + properties: + filter_clause: + type: string + description: Filter Clause + required: true + constraints: + - valid_values: [ OR, AND, NOT ] diff --git a/version.properties b/version.properties index 8f3139abb..937711c74 100644 --- a/version.properties +++ b/version.properties @@ -25,9 +25,9 @@ # Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... ) # because they are used in Jenkins, whose plug-in doesn't support -major=3 +major=4 minor=0 -patch=3 +patch=0 base_version=${major}.${minor}.${patch} |