Remove dead code. Add robot tests 27/86327/1
authorJerry Flood <jflood@att.com>
Thu, 25 Apr 2019 20:46:35 +0000 (16:46 -0400)
committerJerry Flood <jflood@att.com>
Thu, 25 Apr 2019 20:46:46 +0000 (16:46 -0400)
Move interface mocking test code from cmso to robot.

Issue-ID: OPTFRA-474

Change-Id: Ib98f0b16d783e01f888279266dfdee858e30b787
Signed-off-by: Jerry Flood <jflood@att.com>
25 files changed:
cmso-optimizer/etc/config/optimizer.properties
cmso-robot/docker/Dockerfile
cmso-robot/docker/assembly/cmso-files.xml
cmso-robot/ete.sh
cmso-robot/mocking/mock.py [new file with mode: 0755]
cmso-robot/robot/testsuites/ChangeManagementCancel.robot
cmso-robot/robot/testsuites/ChangeManagementDBFailover.robot
cmso-robot/robot/testsuites/ChangeManagementFailure.robot
cmso-robot/robot/testsuites/ChangeManagementFuture.robot
cmso-robot/robot/testsuites/ChangeManagementImmediate.robot
cmso-robot/robot/testsuites/ChangeManagementImmediateFailure.robot
cmso-robot/robot/testsuites/ChangeManagementRejection.robot
cmso-robot/robot/testsuites/CheckLog.robot
cmso-robot/robot/testsuites/CheckScheduleStatus.robot
cmso-robot/robot/testsuites/MiscTests.robot [changed mode: 0644->0755]
cmso-robot/setup.sh [changed mode: 0644->0755]
cmso-service/etc/config/cmso.properties
cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java
cmso-service/src/main/java/org/onap/optf/cmso/common/BasicAuthenticatorFilter.java
cmso-service/src/main/java/org/onap/optf/cmso/common/Mdc.java
cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java [deleted file]
cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java [deleted file]
cmso-sonar/docker/integration/cmso-optimizer/etc/config/optimizer.properties
cmso-sonar/docker/integration/cmso-service/etc/config/cmso.properties
cmso-sonar/docker/integration/docker-compose.yml

index e3ab89a..132408e 100644 (file)
@@ -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
index aa41520..91630a9 100644 (file)
@@ -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
index cb61e5a..4865639 100644 (file)
                        <directory>${project.basedir}/robot</directory>
                        <outputDirectory>/robot</outputDirectory>
                </fileSet>
+               <fileSet>
+                       <includes>
+                               <include>**</include>
+                       </includes>
+                       <directory>${project.basedir}/mocking</directory>
+                       <outputDirectory>/mocking</outputDirectory>
+               </fileSet>
                <fileSet>
                        <includes>
                                <include>ete.sh</include>
index 107c661..dbd058f 100755 (executable)
@@ -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 (executable)
index 0000000..2cb8c3c
--- /dev/null
@@ -0,0 +1,100 @@
+from flask import Flask\r
+from flask import request\r
+from flask import Response\r
+from flask import json\r
+from flask import send_from_directory\r
+import requests\r
+from threading import Thread\r
+import time\r
+\r
+import os\r
+import fnmatch\r
+import re\r
+import time\r
+import datetime\r
+\r
+app = Flask(__name__)\r
+ROOT_MOCK_DIR = os.path.dirname(os.path.abspath(__file__))\r
+DATA_DIR =   os.path.join(ROOT_MOCK_DIR, "data") \r
+global requestNum\r
+requestNum = 1\r
+\r
+########################################################################\r
+########################################################################\r
+@app.route('/onap/so/infra/orchestrationRequests/v7/schedule/<VNFNAME>', methods=['GET', 'POST'])\r
+def soSchedule(VNFNAME):\r
+    if request.method == 'POST':\r
+        testid = request.headers.environ["HTTP_X_TRANSACTIONID"]\r
+        response = {\r
+            "status" : "202",\r
+            "entity" : {\r
+                "requestReferences" : {\r
+                    "requestId" : "000001"\r
+                    }\r
+                }\r
+            }\r
+        resp = Response(json.dumps(response), 200, mimetype='application/json')\r
+        return resp           \r
+\r
+        \r
+    else :\r
+        return "Helloooooo!!!!"\r
+\r
+########################################################################\r
+########################################################################\r
+@app.route('/onap/so/infra/orchestrationRequests/v7/<REQUESTID>', methods=['GET'])\r
+def soStatus(REQUESTID):\r
+    response = {"request" : { "requestStatus" : {\r
+        "requestState" : "COMPLETE",\r
+        "statusMessage" : "Done.",\r
+        "percentProgress" : 100,\r
+        "finishTime" : ""\r
+        }}}\r
+    now = datetime.datetime.utcnow()\r
+    #response["finishTime"] = now.strftime("%Y-%m-%dT%H:%M:%SZ")\r
+    response["request"]["requestStatus"]["finishTime"] = now.strftime("%a, %d %b %Y %H:%M:%S GMT")\r
+    resp = Response(json.dumps(response), 200, mimetype='application/json')\r
+    \r
+    return resp           \r
+\r
+\r
+########################################################################\r
+########################################################################\r
+@app.route('/optimizer/v1/optimize/schedule', methods=['POST'])\r
+def optimizePost():\r
+    response = {}\r
+    resp = Response(json.dumps(response), 200, mimetype='application/json')\r
+    return resp           \r
+\r
+\r
+########################################################################\r
+########################################################################\r
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['GET'])\r
+def optimizeGet(ID):\r
+    response = {}\r
+    resp = Response(json.dumps(response), 200, mimetype='application/json')\r
+    \r
+    return resp           \r
+\r
+########################################################################\r
+########################################################################\r
+@app.route('/optimizer/v1/optimize/schedule/<ID>', methods=['DELETE'])\r
+def optimizeDelete(ID):\r
+    response = {}\r
+    resp = Response(json.dumps(response), 200, mimetype='application/json')\r
+    return resp           \r
+\r
+########################################################################\r
+########################################################################\r
+@app.route('/optimizer/v1/policies', methods=['GET'])\r
+def getPolicies():\r
+    reponse = []\r
+    resp = Response(json.dumps(response), 200, mimetype='application/json')\r
+    \r
+    return resp           \r
+\r
+########################################################################\r
+########################################################################\r
+if __name__ == "__main__":\r
+    app.run(host= '0.0.0.0',port=5000)\r
+    #app.run()
\ No newline at end of file
index ad193f6..30ad8c0 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Verify CMSO schedule cancel.
 
 Library   StringTemplater
 Library   UUID
index a951145..81268e1 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Test specialized DB failover scenarios (not part of ete)
 
 Library   StringTemplater
 Library   UUID
index 5e74105..14d96fa 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Change Management Validation Testing
 
 Library   StringTemplater
 Library   UUID
index 5dad749..8218233 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Verifies ETE Scheduling for future requests
 
 Library   StringTemplater
 Library   UUID
index f7e399a..761deb7 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Verifies ETE Scheduling for immediate requests
 
 Library   StringTemplater
 Library   UUID
index 74f1959..a2de1a9 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Verifies immediate request failures
 
 Library   StringTemplater
 Library   UUID
index ea63ac8..e00fe99 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Verifies rejection of optimized schedules
 
 Library   StringTemplater
 Library   UUID
index 13d7b1c..d1d1304 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Verifies log output (Not part of ETE)
 
 Library   StringTemplater
 Library   UUID
index 2f96ecb..6ee3c65 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation    Creates VID VNF Instance
+Documentation    Verifies scheduler queries
 
 Library   StringTemplater
 Library   UUID
old mode 100644 (file)
new mode 100755 (executable)
index a3b9428..12da302
@@ -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 ***\r
+Documentation    Creates VID VNF Instance\r
+\r
+Library   StringTemplater\r
+Library   UUID\r
+Library   Collections\r
+\r
+Resource    ../resources/optimizer_common.robot\r
+Resource    ../resources/scheduler_common.robot\r
+Resource    ../resources/ticketmgt_common.robot\r
+Resource    ../resources/topology_common.robot\r
+\r
+# Test Setup\r
+# Test Teardown   \r
+*** Variable***\r
+${user_name}=    \r
+${password}=    \r
+${uuid_list_file}=    robot/assets/get_schedule_UUIDs.txt\r
+${template_folder}=    robot/assets/templates/changemanagement\r
+*** Test Cases ***\r
+Test CMSO Optimizer Admin\r
+    [Tags]   ete   \r
+    ${response}=    Get Optimizer Plain Text   alias    admin/password   \r
+    Should Contain   ${response.text}   kECFDaLusYNHTN6Q4DmsYw==\r
+\r
+Test CMSO Service Admin\r
+    [Tags]   ete \r
+    ${response}=    Get Scheduler Plain Text   alias    /cmso/v1/admin/password\r
+    Should Contain   ${response.text}   kECFDaLusYNHTN6Q4DmsYw==\r
+\r
+Test CMSO Ticket Mgt Admin\r
+    [Tags]   ete \r
+    ${response}=    Get Ticket Mgt Plain Text   alias    admin/password\r
+    Should Contain   ${response.text}   kECFDaLusYNHTN6Q4DmsYw==\r
+\r
+Test CMSO Topology Admin\r
+    [Tags]   ete \r
+    ${response}=    Get Topology Plain Text   alias    admin/password\r
+    Should Contain   ${response.text}   kECFDaLusYNHTN6Q4DmsYw==\r
+\r
+Test CMSO Optimizer Health\r
+    [Tags]   ete   \r
+    ${response}=    Get Optimizer   alias    health   \r
+    Dictionary Should Contain Item   ${response.json()}   healthy  True \r
+     \r
+Test CMSO Service Health\r
+    [Tags]   ete \r
+    ${response}=    Get Scheduler   alias    /cmso/v1/health\r
+    Dictionary Should Contain Item   ${response.json()}   healthy  True \r
+       \r
+\r
+Test CMSO Ticket Mgt Health\r
+    [Tags]   ete \r
+    ${response}=    Get Ticket Mgt   alias    health\r
+    Dictionary Should Contain Item   ${response.json()}   healthy  True \r
+    \r
+\r
+Test CMSO Topology Health\r
+    [Tags]   ete \r
+    ${response}=    Get Topology   alias    health\r
+    Dictionary Should Contain Item   ${response.json()}   healthy  True \r
+    \r
+Test CMSO Optimizer Policies\r
+    [Tags]   ete   \r
+    ${response}=    Get Optimizer   alias  policies   \r
+    ##Should Contain   ${response.json()}   kECFDaLusYNHTN6Q4DmsYw==\r
+\r
+Test CMSO Optimizer Get Schedule\r
+    [Tags]   ete   \r
+    ${response}=    Get Optimizer   alias  optimize/schedule/id1   \r
+    ##Should Contain   ${response.json()}   kECFDaLusYNHTN6Q4DmsYw==\r
+\r
+Test CMSO Optimizer Delete Schedule\r
+    [Tags]   ete   \r
+    ${response}=    Delete Optimizer   alias  optimize/schedule/id1   \r
+    ##Should Contain   ${response.json()}   kECFDaLusYNHTN6Q4DmsYw==\r
+\r
+\r
+Test CMSO Ticket Mgt Get Tickets\r
+    [Tags]   ete \r
+    ${response}=    Get Ticket Mgt   alias    tickets\r
+    ##Dictionary Should Contain Item   ${response.json()}   healthy  True \r
+\r
+Test CMSO Ticket Mgt Get Ticket\r
+    [Tags]   ete \r
+    ${response}=    Get Ticket Mgt   alias    ticket/none\r
+    ##Dictionary Should Contain Item   ${response.json()}   healthy  True \r
old mode 100644 (file)
new mode 100755 (executable)
index c28783a..ed06d92 100644 (file)
@@ -92,7 +92,7 @@ loopback.mso.requestId=dummy123
 so.polling.interval.ms=10000\r
 \r
 ## loopback settings\r
-so.url=http://localhost:8080/cmso/v1/loopbacktest/onap/so/infra/orchestrationRequests/v7\r
+so.url=http://localhost:5000/onap/so/infra/orchestrationRequests/v7\r
 so.user=oof@oof.onap.org\r
 so.pass=enc:vfxQdJ1mgdcI7S6SPrzNaw==\r
 \r
index eb4160a..b58b728 100644 (file)
@@ -49,7 +49,6 @@ import org.onap.optf.cmso.filters.CmsoContainerFilters;
 import org.onap.optf.cmso.service.rs.AdminToolImpl;\r
 import org.onap.optf.cmso.service.rs.CmsoServiceImpl;\r
 import org.onap.optf.cmso.service.rs.HealthCheckImpl;\r
-import org.onap.optf.cmso.test.loopback.SchedulerTestLoopbackServiceImpl;\r
 import org.onap.optf.cmso.test.loopback.TicketMgtLoopbackServiceImpl;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.context.annotation.Bean;\r
@@ -83,7 +82,6 @@ public class JerseyConfiguration extends ResourceConfig {
     @Autowired\r
     public JerseyConfiguration( /* LogRequestFilter lrf */ ) {\r
         register(CmsoServiceImpl.class);\r
-        register(SchedulerTestLoopbackServiceImpl.class);\r
         register(TicketMgtLoopbackServiceImpl.class);\r
         register(HealthCheckImpl.class);\r
         register(AdminToolImpl.class);\r
index 048c44c..8f9c00c 100644 (file)
@@ -21,7 +21,6 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 import java.io.IOException;\r
 import java.io.UnsupportedEncodingException;\r
-import javax.servlet.http.HttpServletRequest;\r
 import javax.ws.rs.client.ClientRequestContext;\r
 import javax.ws.rs.client.ClientRequestFilter;\r
 import javax.ws.rs.core.MultivaluedMap;\r
@@ -69,33 +68,4 @@ public class BasicAuthenticatorFilter implements ClientRequestFilter {
         }\r
     }\r
 \r
-    /**\r
-     * Gets the user.\r
-     *\r
-     * @param request the request\r
-     * @return the user\r
-     */\r
-    public static String getUser(HttpServletRequest request) {\r
-        String user = "";\r
-        String header = request.getHeader("Authorization");\r
-        if (header != null) {\r
-            String[] auth = header.split("Basic ");\r
-            if (auth.length == 2) {\r
-                String token = getToken(auth[1]);\r
-                if (token.contains(":")) {\r
-                    String[] tokens = token.split(":");\r
-                    user = tokens[0];\r
-                }\r
-            }\r
-        }\r
-        return user;\r
-    }\r
-\r
-    private static String getToken(String auth) {\r
-        try {\r
-            return new String(DatatypeConverter.parseBase64Binary(auth));\r
-        } catch (Exception e) {\r
-            return auth;\r
-        }\r
-    }\r
 }\r
index d18ded4..503f42c 100644 (file)
@@ -34,30 +34,17 @@ package org.onap.optf.cmso.common;
 import static com.att.eelf.configuration.Configuration.MDC_BEGIN_TIMESTAMP;\r
 import static com.att.eelf.configuration.Configuration.MDC_ELAPSED_TIME;\r
 import static com.att.eelf.configuration.Configuration.MDC_END_TIMESTAMP;\r
-import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;\r
-import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;\r
 import static com.att.eelf.configuration.Configuration.MDC_PARTNER_NAME;\r
-import static com.att.eelf.configuration.Configuration.MDC_REMOTE_HOST;\r
 import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_CODE;\r
 import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_DESC;\r
-import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;\r
-import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;\r
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;\r
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;\r
 import static com.att.eelf.configuration.Configuration.MDC_STATUS_CODE;\r
 import static com.att.eelf.configuration.Configuration.MDC_TARGET_ENTITY;\r
 import static com.att.eelf.configuration.Configuration.MDC_TARGET_SERVICE_NAME;\r
-\r
 import com.att.eelf.utils.Stopwatch;\r
-import java.net.InetAddress;\r
 import java.net.URI;\r
 import java.util.Date;\r
 import java.util.Map;\r
-import java.util.UUID;\r
-import javax.servlet.http.HttpServletRequest;\r
 import javax.ws.rs.core.Response;\r
-import org.onap.optf.cmso.filters.MessageHeaders;\r
-import org.quartz.JobExecutionContext;\r
 import org.slf4j.MDC;\r
 \r
 /**\r
@@ -91,211 +78,13 @@ public class Mdc {
         ErrorCode, ErrorDescription, Timer,\r
     }\r
 \r
-    /**\r
-     * Begin.\r
-     *\r
-     * @param request the request\r
-     * @param requestId the request id\r
-     */\r
-    public static void begin(HttpServletRequest request, String requestId) {\r
-        MDC.clear();\r
-        Stopwatch.start();\r
-        // MDC.put(MDC_ALERT_SEVERITY, "");\r
-        MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));\r
-        // MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));\r
-        // MDC.put(MDC_END_TIMESTAMP, "");\r
-        MDC.put(MDC_INSTANCE_UUID, UUID.randomUUID().toString());\r
-        // MDC.put(MDC_KEY_REQUEST_ID, requestId);\r
-        setRequestId(request, requestId);\r
-        // MDC.put(MDC_PROCESS_KEY, "");\r
-        MDC.put(MDC_REMOTE_HOST, request.getRemoteHost());\r
-        // MDC.put(MDC_RESPONSE_CODE, "");\r
-        // MDC.put(MDC_RESPONSE_DESC, "");\r
-        // MDC.put(MDC_SERVICE_NAME, "");\r
-        try {\r
-            MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());\r
-        } catch (Exception e) {\r
-            MDC.put(MDC_SERVER_FQDN, e.getMessage());\r
-        }\r
-        try {\r
-            MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());\r
-        } catch (Exception e) {\r
-            MDC.put(MDC_SERVER_FQDN, e.getMessage());\r
-        }\r
-        MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
-        MDC.put(MDC_SERVICE_NAME, "cmso");\r
-        // MDC.put(MDC_STATUS_CODE, "");\r
-        setPartherTargetFromUri(request.getRequestURL().toString());\r
-        // Override partner hostname with username\r
-        MDC.put(MDC_PARTNER_NAME, BasicAuthenticatorFilter.getUser(request));\r
-        // MDC.put(MDC_TARGET_ENTITY, "");\r
-        // MDC.put(MDC_TARGET_SERVICE_NAME, "");\r
-        // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");\r
-        MDC.put(Enum.ClassName.name(), getCaller(3));\r
-        // MDC.put(MdcEnum.CustomField1.name(), "");\r
-        // MDC.put(MdcEnum.CustomField2.name(), "");\r
-        // MDC.put(MdcEnum.CustomField3.name(), "");\r
-        // MDC.put(MdcEnum.CustomField4.name(), "");\r
-        // MDC.put(MdcEnum.ErrorCode.name(), "");\r
-        // MDC.put(MdcEnum.ErrorDescription.name(), "");\r
-        // MDC.put(MdcEnum.Timer.name(), "");\r
-        // MDC.put(MdcEnum.Unused.name(), "");\r
-        // MDC.put(MdcEnum.VirtualServerName.name(), "");\r
-\r
-    }\r
-\r
-    private static void setRequestId(HttpServletRequest request, String requestId) {\r
-\r
-        String transactionId = request.getHeader(MessageHeaders.HeadersEnum.TransactionID.toString());\r
-        if (transactionId == null) {\r
-            transactionId = requestId;\r
-        }\r
-        if (transactionId == null) {\r
-            transactionId = "Unknown";\r
-        }\r
-        MDC.put(MDC_KEY_REQUEST_ID, transactionId);\r
-    }\r
-\r
-    /**\r
-     * End.\r
-     *\r
-     * @param response the response\r
-     */\r
-    public static void end(Response response) {\r
-        Stopwatch.stop();\r
-        // MDC.put(MDC_ALERT_SEVERITY, "");\r
-        // MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new\r
-        // Date()));\r
-        MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));\r
-        MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));\r
-        // MDC.put(MDC_INSTANCE_UUID, "");\r
-        // MDC.put(MDC_KEY_REQUEST_ID, "");\r
-        // MDC.put(MDC_PARTNER_NAME, "");\r
-        // MDC.put(MDC_PROCESS_KEY, "");\r
-        // MDC.put(MDC_REMOTE_HOST, "");\r
-        MDC.put(MDC_RESPONSE_CODE, String.valueOf(response.getStatus()));\r
-        MDC.put(MDC_RESPONSE_DESC, response.getStatusInfo().getReasonPhrase());\r
-        // MDC.put(MDC_SERVICE_NAME, "");\r
-        // MDC.put(MDC_SERVER_FQDN, "");\r
-        // MDC.put(MDC_SERVER_IP_ADDRESS, "");\r
-        // MDC.put(MDC_SERVICE_INSTANCE_ID, "");\r
-        // MDC.put(MDC_SERVICE_NAME, "");\r
-        MDC.put(MDC_STATUS_CODE, "COMPLETE");\r
-        if (response.getStatus() == 500) {\r
-            MDC.put(MDC_STATUS_CODE, "ERROR");\r
-        }\r
-        // MDC.put(MDC_TARGET_ENTITY, "");\r
-        // MDC.put(MDC_TARGET_SERVICE_NAME, "");\r
-        // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");\r
-        MDC.put(Enum.ClassName.name(), getCaller(3));\r
-        // MDC.put(MdcEnum.CustomField1.name(), "");\r
-        // MDC.put(MdcEnum.CustomField2.name(), "");\r
-        // MDC.put(MdcEnum.CustomField3.name(), "");\r
-        // MDC.put(MdcEnum.CustomField4.name(), "");\r
-        // MDC.put(MdcEnum.ErrorCode.name(), "");\r
-        // MDC.put(MdcEnum.ErrorDescription.name(), "");\r
-        // MDC.put(MdcEnum.Timer.name(), "");\r
-        // MDC.put(MdcEnum.Unused.name(), "");\r
-        // MDC.put(MdcEnum.VirtualServerName.name(), "");\r
 \r
-    }\r
 \r
     public static String getCaller(int back) {\r
         StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();\r
         return stackTraceElements[back].getClassName() + "." + stackTraceElements[back].getMethodName();\r
     }\r
 \r
-    /**\r
-     * Quartz job begin.\r
-     *\r
-     * @param context the context\r
-     */\r
-    public static void quartzJobBegin(JobExecutionContext context) {\r
-        MDC.clear();\r
-        Stopwatch.start();\r
-        // MDC.put(MDC_ALERT_SEVERITY, "");\r
-        MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));\r
-        // MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));\r
-        // MDC.put(MDC_END_TIMESTAMP, "");\r
-        MDC.put(MDC_INSTANCE_UUID, UUID.randomUUID().toString());\r
-        // MDC.put(MDC_KEY_REQUEST_ID);\r
-        // MDC.put(MDC_PARTNER_NAME, request.getRemoteUser());\r
-        // MDC.put(MDC_PROCESS_KEY, "");\r
-        // MDC.put(MDC_REMOTE_HOST, request.getRemoteHost());\r
-        // MDC.put(MDC_RESPONSE_CODE, "");\r
-        // MDC.put(MDC_RESPONSE_DESC, "");\r
-        // MDC.put(MDC_SERVICE_NAME, "");\r
-        try {\r
-            MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());\r
-        } catch (Exception e) {\r
-            MDC.put(MDC_SERVER_FQDN, e.getMessage());\r
-        }\r
-        try {\r
-            MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());\r
-        } catch (Exception e) {\r
-            MDC.put(MDC_SERVER_FQDN, e.getMessage());\r
-        }\r
-        MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
-        MDC.put(MDC_SERVICE_NAME, "cmso");\r
-        // MDC.put(MDC_STATUS_CODE, "");\r
-        // MDC.put(MDC_TARGET_ENTITY, "");\r
-        // MDC.put(MDC_TARGET_SERVICE_NAME, "");\r
-        // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");\r
-        MDC.put(Enum.ClassName.name(), getCaller(3));\r
-        // MDC.put(MdcEnum.CustomField1.name(), "");\r
-        // MDC.put(MdcEnum.CustomField2.name(), "");\r
-        // MDC.put(MdcEnum.CustomField3.name(), "");\r
-        // MDC.put(MdcEnum.CustomField4.name(), "");\r
-        // MDC.put(MdcEnum.ErrorCode.name(), "");\r
-        // MDC.put(MdcEnum.ErrorDescription.name(), "");\r
-        // MDC.put(MdcEnum.Timer.name(), "");\r
-        // MDC.put(MdcEnum.Unused.name(), "");\r
-        // MDC.put(MdcEnum.VirtualServerName.name(), "");\r
-\r
-    }\r
-\r
-    /**\r
-     * Quartz job end.\r
-     *\r
-     * @param context the context\r
-     */\r
-    public static void quartzJobEnd(JobExecutionContext context) {\r
-        Stopwatch.stop();\r
-        // MDC.put(MDC_ALERT_SEVERITY, "");\r
-        MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));\r
-        MDC.put(MDC_ELAPSED_TIME, String.valueOf(Stopwatch.getDuration()));\r
-        // MDC.put(MDC_START_TIMESTAMP, "");\r
-        // MDC.put(MDC_INSTANCE_UUID, UUID.randomUUID().toString());\r
-        // MDC.put(MDC_KEY_REQUEST_ID);\r
-        // MDC.put(MDC_PARTNER_NAME, request.getRemoteUser());\r
-        // MDC.put(MDC_PROCESS_KEY, "");\r
-        // MDC.put(MDC_REMOTE_HOST, request.getRemoteHost());\r
-        // MDC.put(MDC_RESPONSE_CODE, "");\r
-        // MDC.put(MDC_RESPONSE_DESC, "");\r
-        // MDC.put(MDC_SERVICE_NAME, "");\r
-        // try{ MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); }\r
-        // catch (Exception e){ MDC.put(MDC_SERVER_FQDN, e.getMessage());}\r
-        // try{ MDC.put(MDC_SERVER_IP_ADDRESS,\r
-        // InetAddress.getLocalHost().getHostAddress()); } catch (Exception e){\r
-        // MDC.put(MDC_SERVER_FQDN, e.getMessage());}\r
-        // MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
-        // MDC.put(MDC_SERVICE_NAME, "cmso");\r
-        // MDC.put(MDC_STATUS_CODE, "");\r
-        // MDC.put(MDC_TARGET_ENTITY, "");\r
-        // MDC.put(MDC_TARGET_SERVICE_NAME, "");\r
-        // MDC.put(MDC_TARGET_VIRTUAL_ENTITY, "");\r
-        MDC.put(Enum.ClassName.name(), getCaller(3));\r
-        // MDC.put(MdcEnum.CustomField1.name(), "");\r
-        // MDC.put(MdcEnum.CustomField2.name(), "");\r
-        // MDC.put(MdcEnum.CustomField3.name(), "");\r
-        // MDC.put(MdcEnum.CustomField4.name(), "");\r
-        // MDC.put(MdcEnum.ErrorCode.name(), "");\r
-        // MDC.put(MdcEnum.ErrorDescription.name(), "");\r
-        // MDC.put(MdcEnum.Timer.name(), "");\r
-        // MDC.put(MdcEnum.Unused.name(), "");\r
-        // MDC.put(MdcEnum.VirtualServerName.name(), "");\r
-\r
-    }\r
 \r
     public static Map<String, String> save() {\r
         Map<String, String> save = MDC.getCopyOfContextMap();\r
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 (file)
index 0200520..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
- *\r
- *\r
- * Unless otherwise specified, all documentation contained herein is licensed under the Creative\r
- * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except\r
- * in compliance with the License. You may obtain a copy of the License at\r
- *\r
- * https://creativecommons.org/licenses/by/4.0/\r
- *\r
- * Unless required by applicable law or agreed to in writing, documentation distributed under the\r
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\r
- * express or implied. See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.optf.cmso.test.loopback;\r
-\r
-import io.swagger.annotations.Api;\r
-import io.swagger.annotations.ApiOperation;\r
-import io.swagger.annotations.ApiParam;\r
-import io.swagger.annotations.ApiResponse;\r
-import io.swagger.annotations.ApiResponses;\r
-import javax.ws.rs.GET;\r
-import javax.ws.rs.POST;\r
-import javax.ws.rs.Path;\r
-import javax.ws.rs.PathParam;\r
-import javax.ws.rs.Produces;\r
-import javax.ws.rs.core.Context;\r
-import javax.ws.rs.core.MediaType;\r
-import javax.ws.rs.core.Response;\r
-import javax.ws.rs.core.UriInfo;\r
-import org.onap.optf.cmso.optimizer.model.OptimizerRequest;\r
-import org.onap.optf.cmso.optimizer.model.OptimizerResponse;\r
-import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse;\r
-import org.onap.optf.cmso.wf.bean.WfChangeManagementResponse;\r
-\r
-@Api\r
-@Path("/v1/loopbacktest")\r
-@Produces({MediaType.APPLICATION_JSON})\r
-public interface SchedulerTestLoopbackService {\r
-    // ******************************************************************\r
-    @POST\r
-    @Path("/optimize/schedule")\r
-    @Produces({MediaType.APPLICATION_JSON})\r
-    @ApiOperation(value = "", notes = "Test Optimizer connection in loopback mode.")\r
-    @ApiResponses(value = {@ApiResponse(code = 202, message = "OK"),\r
-                    @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})\r
-    public Response putToOptimizer(@ApiParam(value = "Optimizer request message") OptimizerRequest request,\r
-                    @Context UriInfo uri);\r
-\r
-    // ******************************************************************\r
-    @GET\r
-    @Path("/optimize/schedule/{id}")\r
-    @Produces({MediaType.APPLICATION_JSON})\r
-    @ApiOperation(value = "", notes = "Test Optimizer connection in loopback mode.", response = OptimizerResponse.class)\r
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),\r
-                    @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})\r
-    public Response getOptimizerResponse(@ApiParam(value = "Optimizer request is") @PathParam("id") String id,\r
-                    @Context UriInfo uri);\r
-\r
-    // ******************************************************************\r
-    @POST\r
-    @Path("/onap/so/infra/orchestrationRequests/v7/schedule/{vnfName}")\r
-    @Produces({MediaType.APPLICATION_JSON})\r
-    @ApiOperation(value = "", notes = "Test SO sheduling in loopback mode.",\r
-                    response = WfChangeManagementResponse.class)\r
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),\r
-                    @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})\r
-    public Response soScheduleLoopback(@ApiParam(value = "vnfName") @PathParam("vnfName") String vnfName,\r
-                    @ApiParam(value = "SO request message") String request, @Context UriInfo uri);\r
-\r
-    // ******************************************************************\r
-    @GET\r
-    @Path("/onap/so/infra/orchestrationRequests/v7/{requestId}")\r
-    @Produces({MediaType.APPLICATION_JSON})\r
-    @ApiOperation(value = "", notes = "Test SO Status query loopback.", response = MsoOrchestrationQueryResponse.class)\r
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"),\r
-                    @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})\r
-    public Response soQueryLoopback(@ApiParam(value = "MSO request ID") @PathParam("requestId") String requestId,\r
-                    @Context UriInfo uri);\r
-\r
-}\r
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 (file)
index a834878..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
- *\r
- *\r
- * Unless otherwise specified, all documentation contained herein is licensed under the Creative\r
- * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except\r
- * in compliance with the License. You may obtain a copy of the License at\r
- *\r
- * https://creativecommons.org/licenses/by/4.0/\r
- *\r
- * Unless required by applicable law or agreed to in writing, documentation distributed under the\r
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\r
- * express or implied. See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.optf.cmso.test.loopback;\r
-\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-import com.fasterxml.jackson.databind.ObjectMapper;\r
-import java.util.ArrayList;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.UUID;\r
-import javax.ws.rs.core.Response;\r
-import javax.ws.rs.core.Response.Status;\r
-import javax.ws.rs.core.UriInfo;\r
-import org.joda.time.DateTime;\r
-import org.onap.observations.Observation;\r
-import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.PropertiesManagement;\r
-import org.onap.optf.cmso.common.exceptions.CmsoException;\r
-import org.onap.optf.cmso.optimizer.model.OptimizerElementInfo;\r
-import org.onap.optf.cmso.optimizer.model.OptimizerRequest;\r
-import org.onap.optf.cmso.optimizer.model.OptimizerResponse;\r
-import org.onap.optf.cmso.optimizer.model.OptimizerScheduleInfo;\r
-import org.onap.optf.cmso.optimizer.model.ScheduledElement;\r
-import org.onap.optf.cmso.optimizer.model.ScheduledElement.ScheduleType;\r
-import org.onap.optf.cmso.optimizer.model.UnScheduledElement;\r
-import org.onap.optf.cmso.service.rs.models.v2.ChangeWindow;\r
-import org.onap.optf.cmso.wf.bean.WfCmResponse200;\r
-import org.onap.optf.cmso.wf.bean.WfMsoRequestReferences;\r
-import org.onap.optf.cmso.wf.bean.WfMsoResponse;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.core.env.Environment;\r
-import org.springframework.stereotype.Controller;\r
-\r
-@Controller\r
-public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackService {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(SchedulerTestLoopbackServiceImpl.class);\r
-    private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
-\r
-    @Autowired\r
-    Environment env;\r
-\r
-    @Autowired\r
-    PropertiesManagement pm;\r
-\r
-    // **\r
-    // This is test mode only code.\r
-    private static Map<String, String> optimizerResponses = new HashMap<>();\r
-\r
-    @Override\r
-    public Response putToOptimizer(OptimizerRequest request, UriInfo uri) {\r
-        //\r
-        try {\r
-            OptimizerResponse rsp = new OptimizerResponse();\r
-            rsp.setRequestId(request.getRequestId());\r
-            rsp.setStatus(OptimizerResponse.OptimizeScheduleStatus.COMPLETED);\r
-            List<OptimizerScheduleInfo> schedules = getSchedules(request);\r
-            rsp.setSchedules(schedules);\r
-            ObjectMapper om = new ObjectMapper();\r
-            String response = om.writeValueAsString(rsp);\r
-            optimizerResponses.put(rsp.getRequestId(), response);\r
-            return Response.accepted().build();\r
-        } catch (Exception e) {\r
-            log.error("Unexpected exception", e);\r
-        }\r
-        return Response.serverError().build();\r
-    }\r
-\r
-    private List<OptimizerScheduleInfo> getSchedules(OptimizerRequest request) {\r
-        List<OptimizerScheduleInfo> list = new ArrayList<>();\r
-        OptimizerScheduleInfo osi = new OptimizerScheduleInfo();\r
-        List<ScheduledElement> scheduledList = new ArrayList<>();\r
-        List<UnScheduledElement> unscheduledList = new ArrayList<>();\r
-        osi.setScheduledElements(scheduledList);\r
-        osi.setUnScheduledElements(unscheduledList);\r
-        list.add(osi);\r
-\r
-\r
-        List<ChangeWindow> cws = request.getChangeWindows();\r
-        // Assume we cannot get here without at least 1 CW\r
-        ChangeWindow cw = cws.get(0);\r
-\r
-        // This is a dumb opt. WIll not make sense for multiple groups\r
-        // Use the code in the callback to help\r
-        Map<String, String> nodes = new HashMap<>();\r
-        List<String> nodeList = new ArrayList<>();\r
-        // get total number of nodes across all groups.\r
-        for (OptimizerElementInfo sr : request.getElements()) {\r
-            nodes.put(sr.getElementId(), sr.getGroupId());\r
-            nodeList.add(sr.getElementId());\r
-        }\r
-\r
-        DateTime startTime = new DateTime(cw.getStartTime().getTime());\r
-\r
-\r
-        long add = request.getAdditionalDuration() * 1000L;\r
-        long normal = request.getNormalDuration() * 1000L;\r
-        int concurrencyLimit = request.getConcurrencyLimit();\r
-        long totalDuration = add + normal;\r
-        long serialized = 0;\r
-        if (nodes.size() > concurrencyLimit) {\r
-            serialized = (nodes.size() / concurrencyLimit);\r
-            serialized = (serialized * totalDuration);\r
-        }\r
-        DateTime latestInstanceStartTime = startTime.plus(serialized);\r
-        // Reformat request into a response setting the groups start finish\r
-        // time based upon\r
-\r
-        Map<String, Map<String, Long>> startAndFinishTimeMap = new HashMap<String, Map<String, Long>>();\r
-        try {\r
-            makeMap(startTime.getMillis(), latestInstanceStartTime.getMillis(),\r
-                            concurrencyLimit, totalDuration, nodeList, startAndFinishTimeMap);\r
-            for (String node : nodes.keySet()) {\r
-                Map<String, Long> map = startAndFinishTimeMap.get(node);\r
-                Long nodeStart = map.get("startTime");\r
-                Long nodeEnd = map.get("finishTime");\r
-                ScheduledElement se = new ScheduledElement();\r
-                se.setElementId(node);\r
-                se.setDurationSeconds((nodeEnd - nodeStart) / 1000); // in seconds\r
-                se.setStartTime(new Date(nodeStart));\r
-                se.setEndTime(new Date(nodeEnd));\r
-                se.setScheduleType(ScheduleType.INDIVIDUAL);\r
-                se.setGroupId(nodes.get(node));\r
-                scheduledList.add(se);\r
-            }\r
-        } catch (Exception e) {\r
-            Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
-        }\r
-\r
-        return list;\r
-    }\r
-\r
-    @Override\r
-    public Response getOptimizerResponse(String id, UriInfo uri) {\r
-        //\r
-        try {\r
-            String rsp = optimizerResponses.get(id);\r
-            return Response.ok(rsp).build();\r
-        } catch (Exception e) {\r
-            log.error("Unexpected exception", e);\r
-        }\r
-        return Response.serverError().build();\r
-    }\r
-\r
-\r
-    @Override\r
-    public Response soScheduleLoopback(String vnfName, String request, UriInfo uri) {\r
-        String msoRequestId = env.getProperty("loopback.mso.requestId", "4ccbfb85-1d05-442e");\r
-        String ruuid = UUID.randomUUID().toString();\r
-        WfMsoRequestReferences rr = new WfMsoRequestReferences();\r
-        rr.setInstanceId(ruuid);\r
-        rr.setRequestId(msoRequestId);\r
-        WfMsoResponse mso = new WfMsoResponse();\r
-        mso.setRequestReferences(rr);\r
-        WfCmResponse200 cmResponse = new WfCmResponse200();\r
-        cmResponse.setEntity(mso);\r
-        cmResponse.setStatus(202);;\r
-        return Response.status(Status.OK).entity(cmResponse).build();\r
-    }\r
-\r
-    @Override\r
-    public Response soQueryLoopback(String requestId, UriInfo uri) {\r
-        // Abbreviated response. Only interested in requestStatus....\r
-        String response = "{\"request\" : {" + "\"requestId\" : \"dummy-request-id\","\r
-                        + "\"startTime\" : \"Wed, 26 Aug 2017 06:36:07 GMT\"," + "\"requestScope\" : \"vfModule\","\r
-                        + "\"requestType\" : \"createInstance\"," + "\"requestDetails\" : {},"\r
-                        + "\"instanceReferences\" : {}," + "\"requestStatus\" : { " + "\"requestState\" : \"COMPLETE\","\r
-                        + "\"statusMessage\" : \"Vf Module has been created successfully.\","\r
-                        + "\"percentProgress\" : 100," + "\"finishTime\" : \"Crap so cmso uses current time\"}}}";\r
-        return Response.ok().entity(response).build();\r
-    }\r
-\r
-    /**\r
-     * Make map.\r
-     *\r
-     * @param startTime the start time\r
-     * @param latestInstanceStartTime the latest instance start time\r
-     * @param concurrencyLimit the concurrency limit\r
-     * @param totalDuration the total duration\r
-     * @param nodeList the node list\r
-     * @param startAndFinishTimeMap the start and finish time map\r
-     * @throws CmsoException the CMS exception\r
-     */\r
-    public static void makeMap(Long startTime, Long latestInstanceStartTime, int concurrencyLimit, long totalDuration,\r
-            List<String> nodeList, Map<String, Map<String, Long>> startAndFinishTimeMap) throws CmsoException {\r
-        Long nextStartTime = null;\r
-        Long nextFinishTime = null;\r
-        for (int nodeNumber = 0; nodeNumber < nodeList.size(); nodeNumber++) {\r
-            if (nodeNumber % concurrencyLimit == 0) {\r
-                if (nodeNumber == 0) {\r
-                    nextStartTime = startTime;\r
-                }\r
-                else {\r
-                    nextStartTime = nextStartTime + totalDuration;\r
-                }\r
-                if (nextStartTime > latestInstanceStartTime) {\r
-                    throw new CmsoException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_ALLOCATE_VNF_TIMESLOTS,\r
-                            startTime.toString(), latestInstanceStartTime.toString(), String.valueOf(totalDuration),\r
-                            String.valueOf(concurrencyLimit), String.valueOf(nodeList.size()));\r
-                }\r
-                nextFinishTime = nextStartTime + totalDuration;\r
-            }\r
-            Map<String, Long> map = new HashMap<String, Long>();\r
-            map.put("startTime", nextStartTime);\r
-            map.put("finishTime", nextFinishTime);\r
-            String node = nodeList.get(nodeNumber);\r
-            startAndFinishTimeMap.put(node, map);\r
-        }\r
-\r
-    }\r
-\r
-}\r
index 9ff8213..c03e161 100644 (file)
@@ -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
index ff3dab5..af0fd37 100644 (file)
@@ -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==
 
index ce5a826..448d970 100644 (file)
@@ -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