summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmso-optimizer/etc/config/optimizer.properties13
-rw-r--r--cmso-robot/docker/Dockerfile2
-rw-r--r--cmso-robot/docker/assembly/cmso-files.xml7
-rwxr-xr-xcmso-robot/ete.sh15
-rwxr-xr-xcmso-robot/mocking/mock.py100
-rw-r--r--cmso-robot/robot/testsuites/ChangeManagementCancel.robot2
-rw-r--r--cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot2
-rw-r--r--cmso-robot/robot/testsuites/ChangeManagementFailure.robot2
-rw-r--r--cmso-robot/robot/testsuites/ChangeManagementFuture.robot2
-rw-r--r--cmso-robot/robot/testsuites/ChangeManagementImmediate.robot2
-rw-r--r--cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot2
-rw-r--r--cmso-robot/robot/testsuites/ChangeManagementRejection.robot2
-rw-r--r--cmso-robot/robot/testsuites/CheckLog.robot2
-rw-r--r--cmso-robot/robot/testsuites/CheckScheduleStatus.robot2
-rwxr-xr-x[-rw-r--r--]cmso-robot/robot/testsuites/MiscTests.robot149
-rwxr-xr-x[-rw-r--r--]cmso-robot/setup.sh0
-rw-r--r--cmso-service/etc/config/cmso.properties2
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java2
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java30
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/common/Mdc.java211
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java93
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java238
-rw-r--r--cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties2
-rw-r--r--cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties4
-rw-r--r--cmso-sonar/docker/integration/docker-compose.yml2
25 files changed, 233 insertions, 655 deletions
diff --git a/cmso-optimizer/etc/config/optimizer.properties b/cmso-optimizer/etc/config/optimizer.properties
index e3ab89a..132408e 100644
--- a/cmso-optimizer/etc/config/optimizer.properties
+++ b/cmso-optimizer/etc/config/optimizer.properties
@@ -31,7 +31,7 @@ spring.datasource.tomcat.initialSize=5
spring.datasource.tomcat.max-active=25
spring.datasource.tomcat.test-on-borrow=true
-spring.jpa.show-sql=true
+spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
@@ -39,9 +39,9 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
spring.jpa.hibernate.id.new_generator_mappings=false
hibernate.id.new_generator_mappings=false
-logging.level.org.hibernate.SQL=TRACE
+logging.level.org.hibernate.SQL=WARN
-logging.level.org.hibernate=TRACE
+logging.level.org.hibernate=WARN
healthcheck.cmso.topology.url=http://127.0.0.1:7998/topology/v1/health?checkInterfaces=true
healthcheck.cmso.ticketmgt.url=http://127.0.0.1:7999/ticketmgt/v1/health?checkInterfaces=true
@@ -52,8 +52,11 @@ cmso.topology.create.request.url=http://127.0.0.1:7998/topology/v1/current
cmso.ticket.create.request.url=http://127.0.0.1:7999/ticketmgt/v1/activetickets
cmso.local.policy.folder=data/policies
-cmso.minizinc.command.exe="C:/Program Files/MiniZinc IDE (bundled)/minizinc.exe"
+## MacOS - minizinc IDE has solvers built in
+cmso.minizinc.command.exe=/Applications/MiniZincIDE.app/Contents/Resources/minizinc
+## Windows
+##cmso.minizinc.command.exe="C:/Program Files/MiniZinc IDE (bundled)/minizinc.exe"
cmso.minizinc.command.solver=OSICBC
cmso.minizinc.command.timelimit=60000
cmso.minizinc.command.mzn=scripts/minizinc/generic_attributes.mzn
-cmso.minizinc.command.commandline=cmd.exe /C scripts\\minizinc\\run.bat \ No newline at end of file
+###cmso.minizinc.command.commandline=cmd.exe /C scripts\\minizinc\\run.bat \ No newline at end of file
diff --git a/cmso-robot/docker/Dockerfile b/cmso-robot/docker/Dockerfile
index aa41520..91630a9 100644
--- a/cmso-robot/docker/Dockerfile
+++ b/cmso-robot/docker/Dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update \
COPY /onap-cmso/robot /opt/cmso-robot/robot
+COPY /onap-cmso/mocking /opt/cmso-robot/mocking
COPY /onap-cmso/ete.sh /opt/cmso-robot
RUN chmod 777 /opt/cmso-robot/ete.sh
@@ -40,6 +41,7 @@ RUN pip --version
RUN pip install robotframework==3.1.1
RUN pip install Flask
+RUN pip install requests
RUN pip install selenium
RUN pip install robotframework-sshlibrary
RUN pip install robotframework-requests
diff --git a/cmso-robot/docker/assembly/cmso-files.xml b/cmso-robot/docker/assembly/cmso-files.xml
index cb61e5a..4865639 100644
--- a/cmso-robot/docker/assembly/cmso-files.xml
+++ b/cmso-robot/docker/assembly/cmso-files.xml
@@ -35,6 +35,13 @@
</fileSet>
<fileSet>
<includes>
+ <include>**</include>
+ </includes>
+ <directory>${project.basedir}/mocking</directory>
+ <outputDirectory>/mocking</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <includes>
<include>ete.sh</include>
<include>server.py</include>
</includes>
diff --git a/cmso-robot/ete.sh b/cmso-robot/ete.sh
index 107c661..dbd058f 100755
--- a/cmso-robot/ete.sh
+++ b/cmso-robot/ete.sh
@@ -1,17 +1,30 @@
#!/bin/bash
#
+
ROBOT_CMD="python -m robot.run"
ROBOT_HOME=`pwd`
-ROBOT_PATH=${ROBOT_PATH}:${ROBOT_HOME}/robot/library
+ROBOT_PATH=${ROBOT_PATH}:${ROBOT_HOME}/library
ROBOT_PATH=${ROBOT_PATH}:${ROBOT_HOME}/robot/locallibrary/cmsoUtils
VARIABLE_FILES="${VARIABLE_FILES} -V ${ROBOT_HOME}/robot/assets/test_properties.py"
VARIABLES="${VARIABLES} -v GLOBAL_SCHEDULER_URL:${GLOBAL_SCHEDULER_URL}"
VARIABLES="${VARIABLES} -v GLOBAL_OPTIMIZER_URL:${GLOBAL_OPTIMIZER_URL}"
+VARIABLES="${VARIABLES} -v GLOBAL_TICKET_MGT_URL:${GLOBAL_TICKET_MGT_URL}"
+VARIABLES="${VARIABLES} -v GLOBAL_TOPOLOGY_URL:${GLOBAL_TOPOLOGY_URL}"
VARIABLES="${VARIABLES} -v CMSO_STARTUP_WAIT_TIME:${CMSO_STARTUP_WAIT_TIME}"
HTTP_PROXY=
HTTPS_PROXY=
+export PYTHONPATH=${ROBOT_PATH}:${PYTHONPATH}
+echo PYTHONPATH=${PYTHONPATH}
+pgrep -f mock.py
+if [ $? == 1 ]
+then
+ nohup python ${ROBOT_HOME}/mocking/mock.py &
+fi
+
+
${ROBOT_CMD} ${OUTPUT} -P ${ROBOT_PATH} ${VARIABLE_FILES} ${VARIABLES} ${TAGS} ${ROBOT_HOME}
+pkill -f mock.py \ No newline at end of file
diff --git a/cmso-robot/mocking/mock.py b/cmso-robot/mocking/mock.py
new file mode 100755
index 0000000..2cb8c3c
--- /dev/null
+++ b/cmso-robot/mocking/mock.py
@@ -0,0 +1,100 @@
+from flask import Flask
+from flask import request
+from flask import Response
+from flask import json
+from flask import send_from_directory
+import requests
+from threading import Thread
+import time
+
+import os
+import fnmatch
+import re
+import time
+import datetime
+
+app = Flask(__name__)
+ROOT_MOCK_DIR = os.path.dirname(os.path.abspath(__file__))
+DATA_DIR = os.path.join(ROOT_MOCK_DIR, "data")
+global requestNum
+requestNum = 1
+
+########################################################################
+########################################################################
+@app.route('/onap/so/infra/orchestrationRequests/v7/schedule/<VNFNAME>', methods=['GET', 'POST'])
+def soSchedule(VNFNAME):
+ if request.method == 'POST':
+ testid = request.headers.environ["HTTP_X_TRANSACTIONID"]
+ response = {
+ "status" : "202",
+ "entity" : {
+ "requestReferences" : {
+ "requestId" : "000001"
+ }
+ }
+ }
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+
+ else :
+ return "Helloooooo!!!!"
+
+########################################################################
+########################################################################
+@app.route('/onap/so/infra/orchestrationRequests/v7/<REQUESTID>', methods=['GET'])
+def soStatus(REQUESTID):
+ response = {"request" : { "requestStatus" : {
+ "requestState" : "COMPLETE",
+ "statusMessage" : "Done.",
+ "percentProgress" : 100,
+ "finishTime" : ""
+ }}}
+ now = datetime.datetime.utcnow()
+ #response["finishTime"] = now.strftime("%Y-%m-%dT%H:%M:%SZ")
+ response["request"]["requestStatus"]["finishTime"] = now.strftime("%a, %d %b %Y %H:%M:%S GMT")
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule', methods=['POST'])
+def optimizePost():
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['GET'])
+def optimizeGet(ID):
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['DELETE'])
+def optimizeDelete(ID):
+ response = {}
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+ return resp
+
+########################################################################
+########################################################################
+@app.route('/optimizer/v1/policies', methods=['GET'])
+def getPolicies():
+ reponse = []
+ resp = Response(json.dumps(response), 200, mimetype='application/json')
+
+ return resp
+
+########################################################################
+########################################################################
+if __name__ == "__main__":
+ app.run(host= '0.0.0.0',port=5000)
+ #app.run() \ No newline at end of file
diff --git a/cmso-robot/robot/testsuites/ChangeManagementCancel.robot b/cmso-robot/robot/testsuites/ChangeManagementCancel.robot
index ad193f6..30ad8c0 100644
--- a/cmso-robot/robot/testsuites/ChangeManagementCancel.robot
+++ b/cmso-robot/robot/testsuites/ChangeManagementCancel.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Verify CMSO schedule cancel.
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot b/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot
index a951145..81268e1 100644
--- a/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot
+++ b/cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Test specialized DB failover scenarios (not part of ete)
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/ChangeManagementFailure.robot b/cmso-robot/robot/testsuites/ChangeManagementFailure.robot
index 5e74105..14d96fa 100644
--- a/cmso-robot/robot/testsuites/ChangeManagementFailure.robot
+++ b/cmso-robot/robot/testsuites/ChangeManagementFailure.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Change Management Validation Testing
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/ChangeManagementFuture.robot b/cmso-robot/robot/testsuites/ChangeManagementFuture.robot
index 5dad749..8218233 100644
--- a/cmso-robot/robot/testsuites/ChangeManagementFuture.robot
+++ b/cmso-robot/robot/testsuites/ChangeManagementFuture.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Verifies ETE Scheduling for future requests
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot b/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot
index f7e399a..761deb7 100644
--- a/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot
+++ b/cmso-robot/robot/testsuites/ChangeManagementImmediate.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Verifies ETE Scheduling for immediate requests
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot b/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot
index 74f1959..a2de1a9 100644
--- a/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot
+++ b/cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Verifies immediate request failures
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/ChangeManagementRejection.robot b/cmso-robot/robot/testsuites/ChangeManagementRejection.robot
index ea63ac8..e00fe99 100644
--- a/cmso-robot/robot/testsuites/ChangeManagementRejection.robot
+++ b/cmso-robot/robot/testsuites/ChangeManagementRejection.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Verifies rejection of optimized schedules
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/CheckLog.robot b/cmso-robot/robot/testsuites/CheckLog.robot
index 13d7b1c..d1d1304 100644
--- a/cmso-robot/robot/testsuites/CheckLog.robot
+++ b/cmso-robot/robot/testsuites/CheckLog.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Verifies log output (Not part of ETE)
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/CheckScheduleStatus.robot b/cmso-robot/robot/testsuites/CheckScheduleStatus.robot
index 2f96ecb..6ee3c65 100644
--- a/cmso-robot/robot/testsuites/CheckScheduleStatus.robot
+++ b/cmso-robot/robot/testsuites/CheckScheduleStatus.robot
@@ -1,5 +1,5 @@
*** Settings ***
-Documentation Creates VID VNF Instance
+Documentation Verifies scheduler queries
Library StringTemplater
Library UUID
diff --git a/cmso-robot/robot/testsuites/MiscTests.robot b/cmso-robot/robot/testsuites/MiscTests.robot
index a3b9428..12da302 100644..100755
--- a/cmso-robot/robot/testsuites/MiscTests.robot
+++ b/cmso-robot/robot/testsuites/MiscTests.robot
@@ -1,62 +1,87 @@
-*** Settings ***
-Documentation Creates VID VNF Instance
-
-Library StringTemplater
-Library UUID
-Library Collections
-
-Resource ../resources/optimizer_common.robot
-Resource ../resources/scheduler_common.robot
-Resource ../resources/ticketmgt_common.robot
-Resource ../resources/topology_common.robot
-
-# Test Setup
-# Test Teardown
-*** Variable***
-${user_name}=
-${password}=
-${uuid_list_file}= robot/assets/get_schedule_UUIDs.txt
-${template_folder}= robot/assets/templates/changemanagement
-*** Test Cases ***
-Test CMSO Optimizer Admin
- [Tags] ete
- ${response}= Get Optimizer Plain Text alias admin/password
- Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
-
-Test CMSO Service Admin
- [Tags] ete
- ${response}= Get Scheduler Plain Text alias /cmso/v1/admin/password
- Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
-
-Test CMSO Ticket Mgt Admin
- [Tags] ete
- ${response}= Get Ticket Mgt Plain Text alias admin/password
- Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
-
-Test CMSO Topology Admin
- [Tags] ete
- ${response}= Get Topology Plain Text alias admin/password
- Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
-
-Test CMSO Optimizer Health
- [Tags] ete
- ${response}= Get Optimizer alias health
- Dictionary Should Contain Item ${response.json()} healthy True
-
-Test CMSO Service Health
- [Tags] ete
- ${response}= Get Scheduler alias /cmso/v1/health
- Dictionary Should Contain Item ${response.json()} healthy True
-
-
-Test CMSO Ticket Mgt Health
- [Tags] ete
- ${response}= Get Ticket Mgt alias health
- Dictionary Should Contain Item ${response.json()} healthy True
-
-
-Test CMSO Topology Health
- [Tags] ete
- ${response}= Get Topology alias health
- Dictionary Should Contain Item ${response.json()} healthy True
-
+*** Settings ***
+Documentation Creates VID VNF Instance
+
+Library StringTemplater
+Library UUID
+Library Collections
+
+Resource ../resources/optimizer_common.robot
+Resource ../resources/scheduler_common.robot
+Resource ../resources/ticketmgt_common.robot
+Resource ../resources/topology_common.robot
+
+# Test Setup
+# Test Teardown
+*** Variable***
+${user_name}=
+${password}=
+${uuid_list_file}= robot/assets/get_schedule_UUIDs.txt
+${template_folder}= robot/assets/templates/changemanagement
+*** Test Cases ***
+Test CMSO Optimizer Admin
+ [Tags] ete
+ ${response}= Get Optimizer Plain Text alias admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Service Admin
+ [Tags] ete
+ ${response}= Get Scheduler Plain Text alias /cmso/v1/admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Ticket Mgt Admin
+ [Tags] ete
+ ${response}= Get Ticket Mgt Plain Text alias admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Topology Admin
+ [Tags] ete
+ ${response}= Get Topology Plain Text alias admin/password
+ Should Contain ${response.text} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Optimizer Health
+ [Tags] ete
+ ${response}= Get Optimizer alias health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+Test CMSO Service Health
+ [Tags] ete
+ ${response}= Get Scheduler alias /cmso/v1/health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+
+Test CMSO Ticket Mgt Health
+ [Tags] ete
+ ${response}= Get Ticket Mgt alias health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+
+Test CMSO Topology Health
+ [Tags] ete
+ ${response}= Get Topology alias health
+ Dictionary Should Contain Item ${response.json()} healthy True
+
+Test CMSO Optimizer Policies
+ [Tags] ete
+ ${response}= Get Optimizer alias policies
+ ##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Optimizer Get Schedule
+ [Tags] ete
+ ${response}= Get Optimizer alias optimize/schedule/id1
+ ##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
+
+Test CMSO Optimizer Delete Schedule
+ [Tags] ete
+ ${response}= Delete Optimizer alias optimize/schedule/id1
+ ##Should Contain ${response.json()} kECFDaLusYNHTN6Q4DmsYw==
+
+
+Test CMSO Ticket Mgt Get Tickets
+ [Tags] ete
+ ${response}= Get Ticket Mgt alias tickets
+ ##Dictionary Should Contain Item ${response.json()} healthy True
+
+Test CMSO Ticket Mgt Get Ticket
+ [Tags] ete
+ ${response}= Get Ticket Mgt alias ticket/none
+ ##Dictionary Should Contain Item ${response.json()} healthy True
diff --git a/cmso-robot/setup.sh b/cmso-robot/setup.sh
index ae15e62..ae15e62 100644..100755
--- a/cmso-robot/setup.sh
+++ b/cmso-robot/setup.sh
diff --git a/cmso-service/etc/config/cmso.properties b/cmso-service/etc/config/cmso.properties
index c28783a..ed06d92 100644
--- a/cmso-service/etc/config/cmso.properties
+++ b/cmso-service/etc/config/cmso.properties
@@ -92,7 +92,7 @@ loopback.mso.requestId=dummy123
so.polling.interval.ms=10000
## loopback settings
-so.url=http://localhost:8080/cmso/v1/loopbacktest/onap/so/infra/orchestrationRequests/v7
+so.url=http://localhost:5000/onap/so/infra/orchestrationRequests/v7
so.user=oof@oof.onap.org
so.pass=enc:vfxQdJ1mgdcI7S6SPrzNaw==
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java b/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java
index eb4160a..b58b728 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java
@@ -49,7 +49,6 @@ import org.onap.optf.cmso.filters.CmsoContainerFilters;
import org.onap.optf.cmso.service.rs.AdminToolImpl;
import org.onap.optf.cmso.service.rs.CmsoServiceImpl;
import org.onap.optf.cmso.service.rs.HealthCheckImpl;
-import org.onap.optf.cmso.test.loopback.SchedulerTestLoopbackServiceImpl;
import org.onap.optf.cmso.test.loopback.TicketMgtLoopbackServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -83,7 +82,6 @@ public class JerseyConfiguration extends ResourceConfig {
@Autowired
public JerseyConfiguration( /* LogRequestFilter lrf */ ) {
register(CmsoServiceImpl.class);
- register(SchedulerTestLoopbackServiceImpl.class);
register(TicketMgtLoopbackServiceImpl.class);
register(HealthCheckImpl.class);
register(AdminToolImpl.class);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
index 048c44c..8f9c00c 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
@@ -21,7 +21,6 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.core.MultivaluedMap;
@@ -69,33 +68,4 @@ public class BasicAuthenticatorFilter implements ClientRequestFilter {
}
}
- /**
- * Gets the user.
- *
- * @param request the request
- * @return the user
- */
- public static String getUser(HttpServletRequest request) {
- String user = "";
- String header = request.getHeader("Authorization");
- if (header != null) {
- String[] auth = header.split("Basic ");
- if (auth.length == 2) {
- String token = getToken(auth[1]);
- if (token.contains(":")) {
- String[] tokens = token.split(":");
- user = tokens[0];
- }
- }
- }
- return user;
- }
-
- private static String getToken(String auth) {
- try {
- return new String(DatatypeConverter.parseBase64Binary(auth));
- } catch (Exception e) {
- return auth;
- }
- }
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/common/Mdc.java b/cmso-service/src/main/java/org/onap/optf/cmso/common/Mdc.java
index d18ded4..503f42c 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/common/Mdc.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/common/Mdc.java
@@ -34,30 +34,17 @@ package org.onap.optf.cmso.common;
import static com.att.eelf.configuration.Configuration.MDC_BEGIN_TIMESTAMP;
import static com.att.eelf.configuration.Configuration.MDC_ELAPSED_TIME;
import static com.att.eelf.configuration.Configuration.MDC_END_TIMESTAMP;
-import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
-import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
import static com.att.eelf.configuration.Configuration.MDC_PARTNER_NAME;
-import static com.att.eelf.configuration.Configuration.MDC_REMOTE_HOST;
import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_CODE;
import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_DESC;
-import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
-import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
import static com.att.eelf.configuration.Configuration.MDC_STATUS_CODE;
import static com.att.eelf.configuration.Configuration.MDC_TARGET_ENTITY;
import static com.att.eelf.configuration.Configuration.MDC_TARGET_SERVICE_NAME;
-
import com.att.eelf.utils.Stopwatch;
-import java.net.InetAddress;
import java.net.URI;
import java.util.Date;
import java.util.Map;
-import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
-import org.onap.optf.cmso.filters.MessageHeaders;
-import org.quartz.JobExecutionContext;
import org.slf4j.MDC;
/**
@@ -91,211 +78,13 @@ public class Mdc {
ErrorCode, ErrorDescription, Timer,
}
- /**
- * Begin.
- *
- * @param request the request
- * @param requestId the request id
- */
- public static void begin(HttpServletRequest request, String requestId) {
- MDC.clear();
- Stopwatch.start();
- // MDC.put(MDC_ALERT_SEVERITY, "");
- MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
- // MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));
- // MDC.put(MDC_END_TIMESTAMP, "");
- MDC.put(MDC_INSTANCE_UUID, UUID.randomUUID().toString());
- // MDC.put(MDC_KEY_REQUEST_ID, requestId);
- setRequestId(request, requestId);
- // MDC.put(MDC_PROCESS_KEY, "");
- MDC.put(MDC_REMOTE_HOST, request.getRemoteHost());
- // MDC.put(MDC_RESPONSE_CODE, "");
- // MDC.put(MDC_RESPONSE_DESC, "");
- // MDC.put(MDC_SERVICE_NAME, "");
- try {
- MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
- } catch (Exception e) {
- MDC.put(MDC_SERVER_FQDN, e.getMessage());
- }
- try {
- MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
- } catch (Exception e) {
- MDC.put(MDC_SERVER_FQDN, e.getMessage());
- }
- MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");
- MDC.put(MDC_SERVICE_NAME, "cmso");
- // MDC.put(MDC_STATUS_CODE, "");
- setPartherTargetFromUri(request.getRequestURL().toString());
- // Override partner hostname with username
- MDC.put(MDC_PARTNER_NAME, BasicAuthenticatorFilter.getUser(request));
- // MDC.put(MDC_TARGET_ENTITY, "");
- // MDC.put(MDC_TARGET_SERVICE_NAME, "");
- // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");
- MDC.put(Enum.ClassName.name(), getCaller(3));
- // MDC.put(MdcEnum.CustomField1.name(), "");
- // MDC.put(MdcEnum.CustomField2.name(), "");
- // MDC.put(MdcEnum.CustomField3.name(), "");
- // MDC.put(MdcEnum.CustomField4.name(), "");
- // MDC.put(MdcEnum.ErrorCode.name(), "");
- // MDC.put(MdcEnum.ErrorDescription.name(), "");
- // MDC.put(MdcEnum.Timer.name(), "");
- // MDC.put(MdcEnum.Unused.name(), "");
- // MDC.put(MdcEnum.VirtualServerName.name(), "");
-
- }
-
- private static void setRequestId(HttpServletRequest request, String requestId) {
-
- String transactionId = request.getHeader(MessageHeaders.HeadersEnum.TransactionID.toString());
- if (transactionId == null) {
- transactionId = requestId;
- }
- if (transactionId == null) {
- transactionId = "Unknown";
- }
- MDC.put(MDC_KEY_REQUEST_ID, transactionId);
- }
-
- /**
- * End.
- *
- * @param response the response
- */
- public static void end(Response response) {
- Stopwatch.stop();
- // MDC.put(MDC_ALERT_SEVERITY, "");
- // MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new
- // Date()));
- MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));
- MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
- // MDC.put(MDC_INSTANCE_UUID, "");
- // MDC.put(MDC_KEY_REQUEST_ID, "");
- // MDC.put(MDC_PARTNER_NAME, "");
- // MDC.put(MDC_PROCESS_KEY, "");
- // MDC.put(MDC_REMOTE_HOST, "");
- MDC.put(MDC_RESPONSE_CODE, String.valueOf(response.getStatus()));
- MDC.put(MDC_RESPONSE_DESC, response.getStatusInfo().getReasonPhrase());
- // MDC.put(MDC_SERVICE_NAME, "");
- // MDC.put(MDC_SERVER_FQDN, "");
- // MDC.put(MDC_SERVER_IP_ADDRESS, "");
- // MDC.put(MDC_SERVICE_INSTANCE_ID, "");
- // MDC.put(MDC_SERVICE_NAME, "");
- MDC.put(MDC_STATUS_CODE, "COMPLETE");
- if (response.getStatus() == 500) {
- MDC.put(MDC_STATUS_CODE, "ERROR");
- }
- // MDC.put(MDC_TARGET_ENTITY, "");
- // MDC.put(MDC_TARGET_SERVICE_NAME, "");
- // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");
- MDC.put(Enum.ClassName.name(), getCaller(3));
- // MDC.put(MdcEnum.CustomField1.name(), "");
- // MDC.put(MdcEnum.CustomField2.name(), "");
- // MDC.put(MdcEnum.CustomField3.name(), "");
- // MDC.put(MdcEnum.CustomField4.name(), "");
- // MDC.put(MdcEnum.ErrorCode.name(), "");
- // MDC.put(MdcEnum.ErrorDescription.name(), "");
- // MDC.put(MdcEnum.Timer.name(), "");
- // MDC.put(MdcEnum.Unused.name(), "");
- // MDC.put(MdcEnum.VirtualServerName.name(), "");
- }
public static String getCaller(int back) {
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
return stackTraceElements[back].getClassName() + "." + stackTraceElements[back].getMethodName();
}
- /**
- * Quartz job begin.
- *
- * @param context the context
- */
- public static void quartzJobBegin(JobExecutionContext context) {
- MDC.clear();
- Stopwatch.start();
- // MDC.put(MDC_ALERT_SEVERITY, "");
- MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
- // MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));
- // MDC.put(MDC_END_TIMESTAMP, "");
- MDC.put(MDC_INSTANCE_UUID, UUID.randomUUID().toString());
- // MDC.put(MDC_KEY_REQUEST_ID);
- // MDC.put(MDC_PARTNER_NAME, request.getRemoteUser());
- // MDC.put(MDC_PROCESS_KEY, "");
- // MDC.put(MDC_REMOTE_HOST, request.getRemoteHost());
- // MDC.put(MDC_RESPONSE_CODE, "");
- // MDC.put(MDC_RESPONSE_DESC, "");
- // MDC.put(MDC_SERVICE_NAME, "");
- try {
- MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
- } catch (Exception e) {
- MDC.put(MDC_SERVER_FQDN, e.getMessage());
- }
- try {
- MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
- } catch (Exception e) {
- MDC.put(MDC_SERVER_FQDN, e.getMessage());
- }
- MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");
- MDC.put(MDC_SERVICE_NAME, "cmso");
- // MDC.put(MDC_STATUS_CODE, "");
- // MDC.put(MDC_TARGET_ENTITY, "");
- // MDC.put(MDC_TARGET_SERVICE_NAME, "");
- // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");
- MDC.put(Enum.ClassName.name(), getCaller(3));
- // MDC.put(MdcEnum.CustomField1.name(), "");
- // MDC.put(MdcEnum.CustomField2.name(), "");
- // MDC.put(MdcEnum.CustomField3.name(), "");
- // MDC.put(MdcEnum.CustomField4.name(), "");
- // MDC.put(MdcEnum.ErrorCode.name(), "");
- // MDC.put(MdcEnum.ErrorDescription.name(), "");
- // MDC.put(MdcEnum.Timer.name(), "");
- // MDC.put(MdcEnum.Unused.name(), "");
- // MDC.put(MdcEnum.VirtualServerName.name(), "");
-
- }
-
- /**
- * Quartz job end.
- *
- * @param context the context
- */
- public static void quartzJobEnd(JobExecutionContext context) {
- Stopwatch.stop();
- // MDC.put(MDC_ALERT_SEVERITY, "");
- MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
- MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));
- // MDC.put(MDC_START_TIMESTAMP, "");
- // MDC.put(MDC_INSTANCE_UUID, UUID.randomUUID().toString());
- // MDC.put(MDC_KEY_REQUEST_ID);
- // MDC.put(MDC_PARTNER_NAME, request.getRemoteUser());
- // MDC.put(MDC_PROCESS_KEY, "");
- // MDC.put(MDC_REMOTE_HOST, request.getRemoteHost());
- // MDC.put(MDC_RESPONSE_CODE, "");
- // MDC.put(MDC_RESPONSE_DESC, "");
- // MDC.put(MDC_SERVICE_NAME, "");
- // try{ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); }
- // catch (Exception e){ MDC.put(MDC_SERVER_FQDN, e.getMessage());}
- // try{ MDC.put(MDC_SERVER_IP_ADDRESS,
- // InetAddress.getLocalHost().getHostAddress()); } catch (Exception e){
- // MDC.put(MDC_SERVER_FQDN, e.getMessage());}
- // MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");
- // MDC.put(MDC_SERVICE_NAME, "cmso");
- // MDC.put(MDC_STATUS_CODE, "");
- // MDC.put(MDC_TARGET_ENTITY, "");
- // MDC.put(MDC_TARGET_SERVICE_NAME, "");
- // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");
- MDC.put(Enum.ClassName.name(), getCaller(3));
- // MDC.put(MdcEnum.CustomField1.name(), "");
- // MDC.put(MdcEnum.CustomField2.name(), "");
- // MDC.put(MdcEnum.CustomField3.name(), "");
- // MDC.put(MdcEnum.CustomField4.name(), "");
- // MDC.put(MdcEnum.ErrorCode.name(), "");
- // MDC.put(MdcEnum.ErrorDescription.name(), "");
- // MDC.put(MdcEnum.Timer.name(), "");
- // MDC.put(MdcEnum.Unused.name(), "");
- // MDC.put(MdcEnum.VirtualServerName.name(), "");
-
- }
public static Map<String, String> save() {
Map<String, String> save = MDC.getCopyOfContextMap();
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java
deleted file mode 100644
index 0200520..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
- *
- * 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.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed under the Creative
- * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation 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.
- */
-
-package org.onap.optf.cmso.test.loopback;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import org.onap.optf.cmso.optimizer.model.OptimizerRequest;
-import org.onap.optf.cmso.optimizer.model.OptimizerResponse;
-import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse;
-import org.onap.optf.cmso.wf.bean.WfChangeManagementResponse;
-
-@Api
-@Path("/v1/loopbacktest")
-@Produces({MediaType.APPLICATION_JSON})
-public interface SchedulerTestLoopbackService {
- // ******************************************************************
- @POST
- @Path("/optimize/schedule")
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "", notes = "Test Optimizer connection in loopback mode.")
- @ApiResponses(value = {@ApiResponse(code = 202, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
- public Response putToOptimizer(@ApiParam(value = "Optimizer request message") OptimizerRequest request,
- @Context UriInfo uri);
-
- // ******************************************************************
- @GET
- @Path("/optimize/schedule/{id}")
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "", notes = "Test Optimizer connection in loopback mode.", response = OptimizerResponse.class)
- @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
- public Response getOptimizerResponse(@ApiParam(value = "Optimizer request is") @PathParam("id") String id,
- @Context UriInfo uri);
-
- // ******************************************************************
- @POST
- @Path("/onap/so/infra/orchestrationRequests/v7/schedule/{vnfName}")
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "", notes = "Test SO sheduling in loopback mode.",
- response = WfChangeManagementResponse.class)
- @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
- public Response soScheduleLoopback(@ApiParam(value = "vnfName") @PathParam("vnfName") String vnfName,
- @ApiParam(value = "SO request message") String request, @Context UriInfo uri);
-
- // ******************************************************************
- @GET
- @Path("/onap/so/infra/orchestrationRequests/v7/{requestId}")
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "", notes = "Test SO Status query loopback.", response = MsoOrchestrationQueryResponse.class)
- @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
- public Response soQueryLoopback(@ApiParam(value = "MSO request ID") @PathParam("requestId") String requestId,
- @Context UriInfo uri);
-
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
deleted file mode 100644
index a834878..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
- *
- * 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.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed under the Creative
- * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation 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.
- */
-
-package org.onap.optf.cmso.test.loopback;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-import org.joda.time.DateTime;
-import org.onap.observations.Observation;
-import org.onap.optf.cmso.common.LogMessages;
-import org.onap.optf.cmso.common.PropertiesManagement;
-import org.onap.optf.cmso.common.exceptions.CmsoException;
-import org.onap.optf.cmso.optimizer.model.OptimizerElementInfo;
-import org.onap.optf.cmso.optimizer.model.OptimizerRequest;
-import org.onap.optf.cmso.optimizer.model.OptimizerResponse;
-import org.onap.optf.cmso.optimizer.model.OptimizerScheduleInfo;
-import org.onap.optf.cmso.optimizer.model.ScheduledElement;
-import org.onap.optf.cmso.optimizer.model.ScheduledElement.ScheduleType;
-import org.onap.optf.cmso.optimizer.model.UnScheduledElement;
-import org.onap.optf.cmso.service.rs.models.v2.ChangeWindow;
-import org.onap.optf.cmso.wf.bean.WfCmResponse200;
-import org.onap.optf.cmso.wf.bean.WfMsoRequestReferences;
-import org.onap.optf.cmso.wf.bean.WfMsoResponse;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Controller;
-
-@Controller
-public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackService {
- private static EELFLogger log = EELFManager.getInstance().getLogger(SchedulerTestLoopbackServiceImpl.class);
- private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
-
- @Autowired
- Environment env;
-
- @Autowired
- PropertiesManagement pm;
-
- // **
- // This is test mode only code.
- private static Map<String, String> optimizerResponses = new HashMap<>();
-
- @Override
- public Response putToOptimizer(OptimizerRequest request, UriInfo uri) {
- //
- try {
- OptimizerResponse rsp = new OptimizerResponse();
- rsp.setRequestId(request.getRequestId());
- rsp.setStatus(OptimizerResponse.OptimizeScheduleStatus.COMPLETED);
- List<OptimizerScheduleInfo> schedules = getSchedules(request);
- rsp.setSchedules(schedules);
- ObjectMapper om = new ObjectMapper();
- String response = om.writeValueAsString(rsp);
- optimizerResponses.put(rsp.getRequestId(), response);
- return Response.accepted().build();
- } catch (Exception e) {
- log.error("Unexpected exception", e);
- }
- return Response.serverError().build();
- }
-
- private List<OptimizerScheduleInfo> getSchedules(OptimizerRequest request) {
- List<OptimizerScheduleInfo> list = new ArrayList<>();
- OptimizerScheduleInfo osi = new OptimizerScheduleInfo();
- List<ScheduledElement> scheduledList = new ArrayList<>();
- List<UnScheduledElement> unscheduledList = new ArrayList<>();
- osi.setScheduledElements(scheduledList);
- osi.setUnScheduledElements(unscheduledList);
- list.add(osi);
-
-
- List<ChangeWindow> cws = request.getChangeWindows();
- // Assume we cannot get here without at least 1 CW
- ChangeWindow cw = cws.get(0);
-
- // This is a dumb opt. WIll not make sense for multiple groups
- // Use the code in the callback to help
- Map<String, String> nodes = new HashMap<>();
- List<String> nodeList = new ArrayList<>();
- // get total number of nodes across all groups.
- for (OptimizerElementInfo sr : request.getElements()) {
- nodes.put(sr.getElementId(), sr.getGroupId());
- nodeList.add(sr.getElementId());
- }
-
- DateTime startTime = new DateTime(cw.getStartTime().getTime());
-
-
- long add = request.getAdditionalDuration() * 1000L;
- long normal = request.getNormalDuration() * 1000L;
- int concurrencyLimit = request.getConcurrencyLimit();
- long totalDuration = add + normal;
- long serialized = 0;
- if (nodes.size() > concurrencyLimit) {
- serialized = (nodes.size() / concurrencyLimit);
- serialized = (serialized * totalDuration);
- }
- DateTime latestInstanceStartTime = startTime.plus(serialized);
- // Reformat request into a response setting the groups start finish
- // time based upon
-
- Map<String, Map<String, Long>> startAndFinishTimeMap = new HashMap<String, Map<String, Long>>();
- try {
- makeMap(startTime.getMillis(), latestInstanceStartTime.getMillis(),
- concurrencyLimit, totalDuration, nodeList, startAndFinishTimeMap);
- for (String node : nodes.keySet()) {
- Map<String, Long> map = startAndFinishTimeMap.get(node);
- Long nodeStart = map.get("startTime");
- Long nodeEnd = map.get("finishTime");
- ScheduledElement se = new ScheduledElement();
- se.setElementId(node);
- se.setDurationSeconds((nodeEnd - nodeStart) / 1000); // in seconds
- se.setStartTime(new Date(nodeStart));
- se.setEndTime(new Date(nodeEnd));
- se.setScheduleType(ScheduleType.INDIVIDUAL);
- se.setGroupId(nodes.get(node));
- scheduledList.add(se);
- }
- } catch (Exception e) {
- Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
- }
-
- return list;
- }
-
- @Override
- public Response getOptimizerResponse(String id, UriInfo uri) {
- //
- try {
- String rsp = optimizerResponses.get(id);
- return Response.ok(rsp).build();
- } catch (Exception e) {
- log.error("Unexpected exception", e);
- }
- return Response.serverError().build();
- }
-
-
- @Override
- public Response soScheduleLoopback(String vnfName, String request, UriInfo uri) {
- String msoRequestId = env.getProperty("loopback.mso.requestId", "4ccbfb85-1d05-442e");
- String ruuid = UUID.randomUUID().toString();
- WfMsoRequestReferences rr = new WfMsoRequestReferences();
- rr.setInstanceId(ruuid);
- rr.setRequestId(msoRequestId);
- WfMsoResponse mso = new WfMsoResponse();
- mso.setRequestReferences(rr);
- WfCmResponse200 cmResponse = new WfCmResponse200();
- cmResponse.setEntity(mso);
- cmResponse.setStatus(202);;
- return Response.status(Status.OK).entity(cmResponse).build();
- }
-
- @Override
- public Response soQueryLoopback(String requestId, UriInfo uri) {
- // Abbreviated response. Only interested in requestStatus....
- String response = "{\"request\" : {" + "\"requestId\" : \"dummy-request-id\","
- + "\"startTime\" : \"Wed, 26 Aug 2017 06:36:07 GMT\"," + "\"requestScope\" : \"vfModule\","
- + "\"requestType\" : \"createInstance\"," + "\"requestDetails\" : {},"
- + "\"instanceReferences\" : {}," + "\"requestStatus\" : { " + "\"requestState\" : \"COMPLETE\","
- + "\"statusMessage\" : \"Vf Module has been created successfully.\","
- + "\"percentProgress\" : 100," + "\"finishTime\" : \"Crap so cmso uses current time\"}}}";
- return Response.ok().entity(response).build();
- }
-
- /**
- * Make map.
- *
- * @param startTime the start time
- * @param latestInstanceStartTime the latest instance start time
- * @param concurrencyLimit the concurrency limit
- * @param totalDuration the total duration
- * @param nodeList the node list
- * @param startAndFinishTimeMap the start and finish time map
- * @throws CmsoException the CMS exception
- */
- public static void makeMap(Long startTime, Long latestInstanceStartTime, int concurrencyLimit, long totalDuration,
- List<String> nodeList, Map<String, Map<String, Long>> startAndFinishTimeMap) throws CmsoException {
- Long nextStartTime = null;
- Long nextFinishTime = null;
- for (int nodeNumber = 0; nodeNumber < nodeList.size(); nodeNumber++) {
- if (nodeNumber % concurrencyLimit == 0) {
- if (nodeNumber == 0) {
- nextStartTime = startTime;
- }
- else {
- nextStartTime = nextStartTime + totalDuration;
- }
- if (nextStartTime > latestInstanceStartTime) {
- throw new CmsoException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_ALLOCATE_VNF_TIMESLOTS,
- startTime.toString(), latestInstanceStartTime.toString(), String.valueOf(totalDuration),
- String.valueOf(concurrencyLimit), String.valueOf(nodeList.size()));
- }
- nextFinishTime = nextStartTime + totalDuration;
- }
- Map<String, Long> map = new HashMap<String, Long>();
- map.put("startTime", nextStartTime);
- map.put("finishTime", nextFinishTime);
- String node = nodeList.get(nodeNumber);
- startAndFinishTimeMap.put(node, map);
- }
-
- }
-
-}
diff --git a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties
index 9ff8213..c03e161 100644
--- a/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties
+++ b/cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties
@@ -31,7 +31,7 @@ spring.datasource.tomcat.initialSize=5
spring.datasource.tomcat.max-active=25
spring.datasource.tomcat.test-on-borrow=true
-spring.jpa.show-sql=true
+spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
diff --git a/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties b/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties
index ff3dab5..af0fd37 100644
--- a/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties
+++ b/cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties
@@ -44,7 +44,7 @@ spring.datasource.tomcat.initialSize=5
spring.datasource.tomcat.max-active=25
spring.datasource.tomcat.test-on-borrow=true
-spring.jpa.show-sql=true
+spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming.strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
@@ -94,7 +94,7 @@ so.polling.interval.ms=10000
#mso.pass=enc:bfodXf8qRfCqMvlxVBYNWQ==
## loopback settings
-so.url=http://localhost:8080/cmso/v1/loopbacktest/onap/so/infra/orchestrationRequests/v7
+so.url=http://cmso-robot:5000/onap/so/infra/orchestrationRequests/v7
so.user=cmso@onap.org
so.pass=enc:bfodXf8qRfCqMvlxVBYNWQ==
diff --git a/cmso-sonar/docker/integration/docker-compose.yml b/cmso-sonar/docker/integration/docker-compose.yml
index ce5a826..448d970 100644
--- a/cmso-sonar/docker/integration/docker-compose.yml
+++ b/cmso-sonar/docker/integration/docker-compose.yml
@@ -100,6 +100,8 @@ services:
environment:
- GLOBAL_SCHEDULER_URL=http://cmso-service:8080
- GLOBAL_OPTIMIZER_URL=http://cmso-optimizer:7997
+ - GLOBAL_TICKET_MGT_URL=http://cmso-ticketmgt:7999
+ - GLOBAL_TOPOLOGY_URL=http://cmso-topology:7998
- CMSO_STARTUP_WAIT_TIME=20m
- TAGS=-i ete -i opt_validation
- OUTPUT=-d /share