summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorvrvarma <vv8305@att.com>2019-12-13 10:24:55 -0500
committervrvarma <vv8305@att.com>2019-12-13 10:29:45 -0500
commit430153e1a9489a86cf0ff7942eceb0bf5f1c170c (patch)
treeb22090b80d11761a24d9cbeaa6348704cce2de83 /test
parent34ba229b31758c38a299a163de0007848b5921be (diff)
osdf rearchitecture into apps and libs
Change-Id: I2db2f8e252bd5e60807b2ffabf5a5b193a789f7a Signed-off-by: vrvarma <vv8305@att.com> Issue-ID: OPTFRA-637
Diffstat (limited to 'test')
-rw-r--r--test/conductor/test_conductor_calls.py2
-rw-r--r--test/conductor/test_conductor_translation.py7
-rw-r--r--test/config/log.yml95
-rw-r--r--test/configdb/test_configdb_calls.py2
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Affinity_vCPE_1.json6
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vGMuxInfra.json2
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vG_1.json2
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vGMuxInfra_1.json8
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vG_1.json8
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Placement_Optimization_1.json19
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE.json8
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE_2.json17
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json8
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json8
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vG.json2
-rw-r--r--test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vGMuxInfra.json2
-rw-r--r--test/functest/simulators/simulated-config/log.yml95
-rw-r--r--test/mainapp/test_osdfapp.py15
-rw-r--r--test/policy/test_policy_interface.py8
-rw-r--r--test/test_ConductorApiBuilder.py4
-rw-r--r--test/test_PolicyCalls.py2
-rw-r--r--test/test_api_validation.py11
-rw-r--r--test/test_get_opt_query_data.py2
-rw-r--r--test/test_process_pci_anr_opt.py18
-rw-r--r--test/test_process_pci_opt.py8
-rw-r--r--test/test_process_placement_opt.py7
-rw-r--r--test/test_so_response_gen.py5
27 files changed, 287 insertions, 84 deletions
diff --git a/test/conductor/test_conductor_calls.py b/test/conductor/test_conductor_calls.py
index 77d9a72..52e0367 100644
--- a/test/conductor/test_conductor_calls.py
+++ b/test/conductor/test_conductor_calls.py
@@ -17,7 +17,7 @@
#
import unittest
-from osdf.optimizers.placementopt.conductor import conductor
+from apps.placement.optimizers.conductor import conductor
import osdf.config.loader as config_loader
from osdf.utils.interfaces import json_from_file
from osdf.utils.programming_utils import DotDict
diff --git a/test/conductor/test_conductor_translation.py b/test/conductor/test_conductor_translation.py
index 27711f5..ad70157 100644
--- a/test/conductor/test_conductor_translation.py
+++ b/test/conductor/test_conductor_translation.py
@@ -15,14 +15,11 @@
#
# -------------------------------------------------------------------------
#
-import mock
import unittest
-from flask import Response
-from mock import patch
from osdf.adapters.local_data import local_policies
-from osdf.optimizers.placementopt.conductor import translation as tr
-from osdf.utils.interfaces import json_from_file, yaml_from_file
+from apps.placement.optimizers.conductor import translation as tr
+from osdf.utils.interfaces import json_from_file
class TestConductorTranslation(unittest.TestCase):
diff --git a/test/config/log.yml b/test/config/log.yml
new file mode 100644
index 0000000..0b8815f
--- /dev/null
+++ b/test/config/log.yml
@@ -0,0 +1,95 @@
+version: 1
+disable_existing_loggers: True
+
+loggers:
+ error:
+ handlers: [error_handler]
+ level: "WARN"
+ propagate: True
+ debug:
+ handlers: [debug_handler]
+ level: "DEBUG"
+ propagate: True
+ metrics:
+ handlers: [metrics_handler]
+ level: "INFO"
+ propagate: True
+ audit:
+ handlers: [audit_handler]
+ level: "INFO"
+ propagate: True
+handlers:
+ debug_handler:
+ level: "DEBUG"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/debug.log"
+ formatter: "debugFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+ error_handler:
+ level: "WARN"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/error.log"
+ formatter: "errorFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+ metrics_handler:
+ level: "INFO"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/metrics.log"
+ formatter: "metricsFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+ audit_handler:
+ level: "INFO"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/audit.log"
+ formatter: "auditFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+formatters:
+ standard:
+ format: "%(asctime)s|||||%(name)s||%(thread)||%(funcName)s||%(levelname)s||%(message)s"
+ debugFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {threadID} {serverName} {serviceName} {instanceUUID} {upperLogLevel} {severity} {serverIPAddress} {server} {IPAddress} {className} {timer} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+ errorFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {threadID} {serviceName} {partnerName} {targetEntity} {targetServiceName} {errorCode} {errorDescription} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+ auditFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {serviceInstanceID} {threadID} {serverName} {serviceName} {partnerName} {statusCode} {responseCode} {responseDescription} {instanceUUID} {upperLogLevel} {severity} \
+ {serverIPAddress} {timer} {server} {IPAddress} {className} {unused} {processKey} {customField1} {customField2} {customField3} {customField4} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+ metricsFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {serviceInstanceID} {threadID} {serverName} {serviceName} {partnerName} \
+ {targetEntity} {targetServiceName} {statusCode} {responseCode} {responseDescription} \
+ {instanceUUID} {upperLogLevel} {severity} {serverIPAddress} {timer} {server} {IPAddress} \
+ {className} {unused} {processKey} {targetVirtualEntity} {customField1} {customField2} \
+ {customField3} {customField4} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+
+ mdcFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {invocationID} {serviceName} {serviceIP}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
diff --git a/test/configdb/test_configdb_calls.py b/test/configdb/test_configdb_calls.py
index eb799e7..a6f1c97 100644
--- a/test/configdb/test_configdb_calls.py
+++ b/test/configdb/test_configdb_calls.py
@@ -16,7 +16,7 @@
# -------------------------------------------------------------------------
#
-from osdf.optimizers.pciopt.configdb import request
+from apps.pci.optimizers.configdb import request
import osdf.config.loader as config_loader
from osdf.utils.interfaces import json_from_file
from osdf.utils.programming_utils import DotDict
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Affinity_vCPE_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Affinity_vCPE_1.json
index 6f0ecb3..2953589 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Affinity_vCPE_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Affinity_vCPE_1.json
@@ -1,7 +1,7 @@
{
- "service": "zone",
- "policyName": "OSDF_R2.Affinity_vCPE_1",
- "description": "Optimization query policy for vCPE",
+ "service": "affinityPolicy",
+ "policyName": "OSDF_DUBLIN.Affinity_vCPE_1",
+ "description": "Zone policy for vCPE",
"templateVersion": "OpenSource.version.1",
"version": "test1",
"priority": "3",
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vGMuxInfra.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vGMuxInfra.json
index 2578544..010cf3f 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vGMuxInfra.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vGMuxInfra.json
@@ -1,6 +1,6 @@
{
"service": "vim_fit",
- "policyName": "OSDF_R2.Capacity_vGMuxInfra",
+ "policyName": "OSDF_DUBLIN.Capacity_vGMuxInfra",
"description": "Capacity policy for vGMuxInfra",
"templateVersion": "OpenSource.version.1",
"version": "test1",
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vG_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vG_1.json
index c1682fa..fedcc4f 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vG_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Capacity_vG_1.json
@@ -1,6 +1,6 @@
{
"service": "vim_fit",
- "policyName": "OSDF_R2.Capacity_vG_1",
+ "policyName": "OSDF_DUBLIN.Capacity_vG_1",
"description": "Capacity policy for vG",
"templateVersion": "OpenSource.version.1",
"version": "test1",
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vGMuxInfra_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vGMuxInfra_1.json
index 61ec500..e3ba83c 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vGMuxInfra_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vGMuxInfra_1.json
@@ -1,6 +1,6 @@
{
- "service": "distance_to_location",
- "policyName": "OSDF_R2.Distance_vGMuxInfra",
+ "service": "distancePolicy",
+ "policyName": "OSDF_DUBLIN.Distance_vGMuxInfra",
"description": "Distance Policy for vGMuxInfra",
"templateVersion": "OpenSource.version.1",
"version": "test1",
@@ -10,13 +10,13 @@
"guard": "False",
"content": {
"distanceProperties": {
- "locationInfo": "customer_location",
+ "locationInfo": "customer_loc",
"distance": { "value": "500", "operator": "<", "unit": "km" }
},
"identity": "distance-vGMuxInfra",
"resources": ["vGMuxInfra"],
"policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"],
- "policyType": "distancePolicy",
+ "policyType": "distance_to_location",
"applicableResources": "any"
}
}
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vG_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vG_1.json
index 06c3ada..c498c7a 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vG_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Distance_vG_1.json
@@ -1,6 +1,6 @@
{
- "service": "distance_to_location",
- "policyName": "OSDF_R2.Distance_vG_1",
+ "service": "distancePolicy",
+ "policyName": "OSDF_DUBLIN.Distance_vG_1",
"description": "Distance Policy for vG",
"templateVersion": "OpenSource.version.1",
"version": "test1",
@@ -10,13 +10,13 @@
"guard": "False",
"content": {
"distanceProperties": {
- "locationInfo": "customer_location",
+ "locationInfo": "customer_loc",
"distance": { "value": "1500", "operator": "<", "unit": "km" }
},
"identity": "distance-vG",
"resources": ["vG"],
"policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"],
- "policyType": "distancePolicy",
+ "policyType": "distance_to_location",
"applicableResources": "any"
}
}
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Placement_Optimization_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Placement_Optimization_1.json
index ab3c586..9b062b0 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Placement_Optimization_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/Placement_Optimization_1.json
@@ -1,6 +1,6 @@
{
- "service": "placementOptimization",
- "policyName": "OSDF_R2.Placement_Optimization_1",
+ "service": "optimizationPolicy",
+ "policyName": "OSDF_DUBLIN.Placement_Optimization_1",
"description": "Placement Optimization Policy for vGMuxInfra",
"templateVersion": "OpenSource.version.1",
"version": "test1",
@@ -30,13 +30,26 @@
"parameter": "hpa_score",
"weight": "200",
"operator": "product"
+ },
+ {
+ "resources": ["vFW"],
+ "customerLocationInfo": "customer_loc",
+ "parameter": "distance",
+ "weight": "100",
+ "operator": "product"
+ },
+ {
+ "resources": ["vFW"],
+ "parameter": "hpa_score",
+ "weight": "200",
+ "operator": "product"
}
],
"operator": "sum"
},
"identity": "optimization",
"policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"],
- "policyType": "placementOptimization",
+ "policyType": "placement_optimization",
"objective": "minimize"
}
}
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE.json
index 27f49d2..5097964 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE.json
@@ -1,7 +1,7 @@
{
- "service": "optimizationQueryPolicy",
- "policyName": "OSDF_R2.QueryPolicy_vCPE",
- "description": "Optimization query policy for vCPE",
+ "service": "queryPolicy",
+ "policyName": "OSDF_DUBLIN.QueryPolicy_vCPE",
+ "description": "Query policy for vCPE",
"templateVersion": "OpenSource.version.1",
"version": "test1",
"priority": "3",
@@ -14,7 +14,7 @@
{"attribute":"customerLongitude", "attribute_location": "customerLongitude"}
],
"policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"],
- "policyType": "optimizationQueryPolicy",
+ "policyType": "request_param_query",
"serviceName": "vCPE",
"identity": "vCPE_Query_Policy"
}
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE_2.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE_2.json
index 7f1db83..e398f39 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE_2.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/QueryPolicy_vCPE_2.json
@@ -1,10 +1,10 @@
{
- "service": "optimizationQueryPolicy",
- "policyName": "oofBeijing.queryPolicy_vCPE",
- "description": "Optimization query policy for vCPE",
- "templateVersion": "0.0.1",
- "version": "oofBeijing",
- "priority": "5",
+ "service": "queryPolicy",
+ "policyName": "OSDF_DUBLIN.queryPolicy_vCPE",
+ "description": "Query policy for vCPE",
+ "templateVersion": "OpenSource.version.1",
+ "version": "test1",
+ "priority": "3",
"riskType": "test",
"riskLevel": "2",
"guard": "False",
@@ -17,7 +17,8 @@
{"attribute":"customerLongitude", "attribute_location": "customerLongitude", "value": 2.2}
],
"serviceName": "vCPE",
- "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG", "optimizationQueryPolicy"],
- "policyType": "optimizationQueryPolicy"
+ "policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra", "vG"],
+ "policyType": "request_param_query",
+ "identity": "vCPE_Query_Policy"
}
}
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json
index ce0b7e3..690f5dc 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vGMuxInfra_1.json
@@ -1,6 +1,6 @@
{
"service": "hpaPolicy",
- "policyName": "OSDF_R2.hpa_policy_vGMuxInfra_1",
+ "policyName": "OSDF_DUBLIN.hpa_policy_vGMuxInfra_1",
"description": "HPA policy for vGMuxInfra",
"templateVersion": "OpenSource.version.1",
"version": "test1",
@@ -9,10 +9,10 @@
"riskLevel": "2",
"guard": "False",
"content": {
- "resources": "vGMuxInfra",
- "identity": "hpaPolicy_vGMuxInfra",
+ "resources": ["vGMuxInfra"],
+ "identity": "hpa-vGMuxInfra",
"policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vGMuxInfra"],
- "policyType": "hpaPolicy",
+ "policyType": "hpa",
"flavorFeatures": [
{
"id": "vgmux_1",
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json
index 5d2499f..b29c67d 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/hpa_policy_vG_1.json
@@ -1,6 +1,6 @@
{
"service": "hpaPolicy",
- "policyName": "OSDF_R2.hpa_policy_vG_1",
+ "policyName": "OSDF_DUBLIN.hpa_policy_vG_1",
"description": "HPA policy for vG",
"templateVersion": "OpenSource.version.1",
"version": "test1",
@@ -9,10 +9,10 @@
"riskLevel": "2",
"guard": "False",
"content": {
- "resources": "vG",
- "identity": "hpaPolicy_vG",
+ "resources": ["vG"],
+ "identity": "hpa-vG",
"policyScope": ["vCPE", "US", "INTERNATIONAL", "ip", "vG"],
- "policyType": "hpaPolicy",
+ "policyType": "hpa",
"flavorFeatures": [
{
"id": "vg_1",
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vG.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vG.json
index d215078..b047686 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vG.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vG.json
@@ -1,6 +1,6 @@
{
"service": "vnfPolicy",
- "policyName": "OSDF_R2.vnfPolicy_vG",
+ "policyName": "OSDF_DUBLIN.vnfPolicy_vG",
"description": "vnfPolicy",
"templateVersion": "OpenSource.version.1",
"version": "test1",
diff --git a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vGMuxInfra.json b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vGMuxInfra.json
index 6849105..45d67f6 100644
--- a/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vGMuxInfra.json
+++ b/test/functest/simulators/policy/response-payloads/pdp-has-vcpe-good/vnfPolicy_vGMuxInfra.json
@@ -1,6 +1,6 @@
{
"service": "vnfPolicy",
- "policyName": "OSDF_R2.vnfPolicy_vGMuxInfra",
+ "policyName": "OSDF_DUBLIN.vnfPolicy_vGMuxInfra",
"description": "vnfPolicy",
"templateVersion": "OpenSource.version.1",
"version": "test1",
diff --git a/test/functest/simulators/simulated-config/log.yml b/test/functest/simulators/simulated-config/log.yml
new file mode 100644
index 0000000..0b8815f
--- /dev/null
+++ b/test/functest/simulators/simulated-config/log.yml
@@ -0,0 +1,95 @@
+version: 1
+disable_existing_loggers: True
+
+loggers:
+ error:
+ handlers: [error_handler]
+ level: "WARN"
+ propagate: True
+ debug:
+ handlers: [debug_handler]
+ level: "DEBUG"
+ propagate: True
+ metrics:
+ handlers: [metrics_handler]
+ level: "INFO"
+ propagate: True
+ audit:
+ handlers: [audit_handler]
+ level: "INFO"
+ propagate: True
+handlers:
+ debug_handler:
+ level: "DEBUG"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/debug.log"
+ formatter: "debugFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+ error_handler:
+ level: "WARN"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/error.log"
+ formatter: "errorFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+ metrics_handler:
+ level: "INFO"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/metrics.log"
+ formatter: "metricsFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+ audit_handler:
+ level: "INFO"
+ class: "logging.handlers.TimedRotatingFileHandler"
+ filename: "logs/audit.log"
+ formatter: "auditFormat"
+ when: midnight
+ interval: 1
+ utc: True
+ delay: False
+ backupCount: 10
+formatters:
+ standard:
+ format: "%(asctime)s|||||%(name)s||%(thread)||%(funcName)s||%(levelname)s||%(message)s"
+ debugFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {threadID} {serverName} {serviceName} {instanceUUID} {upperLogLevel} {severity} {serverIPAddress} {server} {IPAddress} {className} {timer} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+ errorFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {threadID} {serviceName} {partnerName} {targetEntity} {targetServiceName} {errorCode} {errorDescription} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+ auditFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {serviceInstanceID} {threadID} {serverName} {serviceName} {partnerName} {statusCode} {responseCode} {responseDescription} {instanceUUID} {upperLogLevel} {severity} \
+ {serverIPAddress} {timer} {server} {IPAddress} {className} {unused} {processKey} {customField1} {customField2} {customField3} {customField4} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+ metricsFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {serviceInstanceID} {threadID} {serverName} {serviceName} {partnerName} \
+ {targetEntity} {targetServiceName} {statusCode} {responseCode} {responseDescription} \
+ {instanceUUID} {upperLogLevel} {severity} {serverIPAddress} {timer} {server} {IPAddress} \
+ {className} {unused} {processKey} {targetVirtualEntity} {customField1} {customField2} \
+ {customField3} {customField4} {detailMessage}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+
+ mdcFormat:
+ format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s"
+ mdcfmt: "{requestID} {invocationID} {serviceName} {serviceIP}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
diff --git a/test/mainapp/test_osdfapp.py b/test/mainapp/test_osdfapp.py
index 7fbe707..d1f6d7e 100644
--- a/test/mainapp/test_osdfapp.py
+++ b/test/mainapp/test_osdfapp.py
@@ -15,9 +15,10 @@
#
# -------------------------------------------------------------------------
#
-import osdfapp
+
import unittest
+from osdf.apps import baseapp
from osdf.operation.exceptions import BusinessException
from requests import Request, RequestException
from schematics.exceptions import DataError
@@ -28,7 +29,7 @@ from unittest.mock import patch
class TestOSDFApp(TestCase):
def setUp(self):
- self.patcher_g = patch('osdfapp.g', return_value={'request_id':'DUMMY-REQ'})
+ self.patcher_g = patch('osdf.apps.baseapp.g', return_value={'request_id':'DUMMY-REQ'})
self.Mock_g = self.patcher_g.start()
# self.patcher2 = patch('package.module.Class2')
# self.MockClass2 = self.patcher2.start()
@@ -47,26 +48,26 @@ class TestOSDFApp(TestCase):
def test_handle_business_exception(self):
e = BusinessException("Business Exception Description")
- resp = osdfapp.handle_business_exception(e)
+ resp = baseapp.handle_business_exception(e)
assert resp.status_code == 400
def test_handle_request_exception(self):
e = self.dummy_request_exception()
- resp = osdfapp.handle_request_exception(e)
+ resp = baseapp.handle_request_exception(e)
assert resp.status_code == 400
def test_handle_data_error(self):
e = DataError({"A1": "A1 Data Error"})
- resp = osdfapp.handle_data_error(e)
+ resp = baseapp.handle_data_error(e)
assert resp.status_code == 400
def test_internal_failure(self):
e = Exception("An Internal Error")
- resp = osdfapp.internal_failure(e)
+ resp = baseapp.internal_failure(e)
assert resp.status_code == 500
def test_get_options_default(self):
- opts = osdfapp.get_options(["PROG"]) # ensure nothing breaks
+ opts = baseapp.get_options(["PROG"]) # ensure nothing breaks
if __name__ == "__main__":
diff --git a/test/policy/test_policy_interface.py b/test/policy/test_policy_interface.py
index 4f1efcf..082b7f9 100644
--- a/test/policy/test_policy_interface.py
+++ b/test/policy/test_policy_interface.py
@@ -15,16 +15,16 @@
#
# -------------------------------------------------------------------------
#
-import mock
import os
import unittest
-from osdf.adapters.local_data import local_policies
+import mock
+
import osdf.config.loader as config_loader
+from osdf.adapters.local_data import local_policies
+from osdf.adapters.policy import interface as pol
from osdf.utils.interfaces import json_from_file
from osdf.utils.programming_utils import DotDict
-from osdf.optimizers.placementopt.conductor import translation as tr
-from osdf.adapters.policy import interface as pol
class TestPolicyInterface(unittest.TestCase):
diff --git a/test/test_ConductorApiBuilder.py b/test/test_ConductorApiBuilder.py
index 7e38f4d..e69e954 100644
--- a/test/test_ConductorApiBuilder.py
+++ b/test/test_ConductorApiBuilder.py
@@ -19,8 +19,8 @@ import unittest
import json
import yaml
+from apps.placement.optimizers.conductor.api_builder import conductor_api_builder
from osdf.adapters.local_data import local_policies
-from osdf.optimizers.placementopt.conductor.api_builder import conductor_api_builder
from osdf.utils.interfaces import json_from_file
@@ -28,7 +28,7 @@ class TestConductorApiBuilder(unittest.TestCase):
def setUp(self):
self.main_dir = ""
- self.conductor_api_template = self.main_dir + "osdf/templates/conductor_interface.json"
+ self.conductor_api_template = self.main_dir + "apps/placement/templates/conductor_interface.json"
self.local_config_file = self.main_dir + "config/common_config.yaml"
policy_data_path = self.main_dir + "test/policy-local-files" # "test/policy-local-files"
diff --git a/test/test_PolicyCalls.py b/test/test_PolicyCalls.py
index 4c9366a..e7e8eab 100644
--- a/test/test_PolicyCalls.py
+++ b/test/test_PolicyCalls.py
@@ -24,7 +24,7 @@ from osdf.adapters.policy import interface
from osdf.utils.interfaces import RestClient, json_from_file
import yaml
from mock import patch
-from osdf.optimizers.placementopt.conductor import translation
+from apps.placement.optimizers.conductor import translation
from osdf.operation.exceptions import BusinessException
diff --git a/test/test_api_validation.py b/test/test_api_validation.py
index 389ff62..73d03cd 100644
--- a/test/test_api_validation.py
+++ b/test/test_api_validation.py
@@ -18,9 +18,10 @@
import json
import unittest
-from osdf.models.api.placementRequest import PlacementAPI
-from osdf.models.api.placementResponse import PlacementResponse
-from schematics.exceptions import ModelValidationError
+from schematics.exceptions import DataError
+
+from apps.placement.models.api.placementRequest import PlacementAPI
+from apps.placement.models.api.placementResponse import PlacementResponse
class TestReqValidation(unittest.TestCase):
@@ -37,7 +38,7 @@ class TestReqValidation(unittest.TestCase):
def test_req_failure(self):
req_json = {}
- self.assertRaises(ModelValidationError, lambda: PlacementAPI(req_json).validate())
+ self.assertRaises(DataError, lambda: PlacementAPI(req_json).validate())
class TestResponseValidation(unittest.TestCase):
@@ -54,7 +55,7 @@ class TestResponseValidation(unittest.TestCase):
def test_invalid_response(self):
resp_json = {}
- self.assertRaises(ModelValidationError, lambda: PlacementResponse(resp_json).validate())
+ self.assertRaises(DataError, lambda: PlacementResponse(resp_json).validate())
if __name__ == "__main__":
diff --git a/test/test_get_opt_query_data.py b/test/test_get_opt_query_data.py
index 1e2db17..a7a4d88 100644
--- a/test/test_get_opt_query_data.py
+++ b/test/test_get_opt_query_data.py
@@ -17,7 +17,7 @@
#
import unittest
import json
-from osdf.optimizers.placementopt.conductor.translation import get_opt_query_data
+from apps.placement.optimizers.conductor.translation import get_opt_query_data
class TestGetOptQueryData(unittest.TestCase):
diff --git a/test/test_process_pci_anr_opt.py b/test/test_process_pci_anr_opt.py
index 8c6a34c..b717d32 100644
--- a/test/test_process_pci_anr_opt.py
+++ b/test/test_process_pci_anr_opt.py
@@ -15,14 +15,15 @@
#
# -------------------------------------------------------------------------
#
-import mock
import unittest
+import mock
from flask import Response
from mock import patch
-from osdf.adapters.local_data import local_policies
-from osdf.optimizers.pciopt.pci_opt_processor import process_pci_optimation
+
import osdf.config.loader as config_loader
+from apps.pci.optimizers.pci_opt_processor import process_pci_optimation
+from osdf.adapters.local_data import local_policies
from osdf.utils.interfaces import json_from_file
from osdf.utils.programming_utils import DotDict
@@ -31,19 +32,19 @@ class TestProcessPlacementOpt(unittest.TestCase):
def setUp(self):
mock_req_accept_message = Response("Accepted Request", content_type='application/json; charset=utf-8')
- self.patcher_req = patch('osdf.optimizers.pciopt.configdb.request',
+ self.patcher_req = patch('apps.pci.optimizers.configdb.request',
return_value={"solutionInfo": {"placementInfo": "dummy"}})
self.patcher_req_accept = patch('osdf.operation.responses.osdf_response_for_request_accept',
return_value=mock_req_accept_message)
self.patcher_callback = patch(
- 'osdf.optimizers.pciopt.pci_opt_processor.process_pci_optimation',
+ 'apps.pci.optimizers.pci_opt_processor.process_pci_optimation',
return_value=mock_req_accept_message)
mock_mzn_response = [{'pci': {0: 0, 1: 1, 2: 2, 3: 3, 4: 0}, 'used_ignorables': [0]}]
self.patcher_minizinc_callback = patch(
- 'osdf.optimizers.pciopt.solver.optimizer.solve',
- return_value=mock_mzn_response )
+ 'apps.pci.optimizers.solver.optimizer.solve',
+ return_value=mock_mzn_response)
self.patcher_RestClient = patch(
'osdf.utils.interfaces.RestClient', return_value=mock.MagicMock())
self.Mock_req = self.patcher_req.start()
@@ -71,9 +72,8 @@ class TestProcessPlacementOpt(unittest.TestCase):
request_json = json_from_file(parameter_data_file)
policies = [json_from_file(policy_data_path + '/' + name) for name in valid_policies_files]
- templ_string = process_pci_optimation(request_json, self.osdf_config,policies)
+ templ_string = process_pci_optimation(request_json, self.osdf_config, policies)
if __name__ == "__main__":
unittest.main()
-
diff --git a/test/test_process_pci_opt.py b/test/test_process_pci_opt.py
index 31aa5fb..ffbc718 100644
--- a/test/test_process_pci_opt.py
+++ b/test/test_process_pci_opt.py
@@ -21,7 +21,7 @@ import unittest
from flask import Response
from mock import patch
from osdf.adapters.local_data import local_policies
-from osdf.optimizers.pciopt.pci_opt_processor import process_pci_optimation
+from apps.pci.optimizers.pci_opt_processor import process_pci_optimation
import osdf.config.loader as config_loader
from osdf.utils.interfaces import json_from_file
from osdf.utils.programming_utils import DotDict
@@ -31,18 +31,18 @@ class TestProcessPlacementOpt(unittest.TestCase):
def setUp(self):
mock_req_accept_message = Response("Accepted Request", content_type='application/json; charset=utf-8')
- self.patcher_req = patch('osdf.optimizers.pciopt.configdb.request',
+ self.patcher_req = patch('apps.pci.optimizers.configdb.request',
return_value={"solutionInfo": {"placementInfo": "dummy"}})
self.patcher_req_accept = patch('osdf.operation.responses.osdf_response_for_request_accept',
return_value=mock_req_accept_message)
self.patcher_callback = patch(
- 'osdf.optimizers.pciopt.pci_opt_processor.process_pci_optimation',
+ 'apps.pci.optimizers.pci_opt_processor.process_pci_optimation',
return_value=mock_req_accept_message)
mock_mzn_response = [{'pci': {0: 0, 1: 1, 2: 2}}]
self.patcher_minizinc_callback = patch(
- 'osdf.optimizers.pciopt.solver.optimizer.solve',
+ 'apps.pci.optimizers.solver.optimizer.solve',
return_value=mock_mzn_response )
self.patcher_RestClient = patch(
'osdf.utils.interfaces.RestClient', return_value=mock.MagicMock())
diff --git a/test/test_process_placement_opt.py b/test/test_process_placement_opt.py
index 62a1ce6..64b69a8 100644
--- a/test/test_process_placement_opt.py
+++ b/test/test_process_placement_opt.py
@@ -20,8 +20,9 @@ import unittest
from flask import Response
from mock import patch
+
+from apps.placement.optimizers.conductor.remote_opt_processor import process_placement_opt
from osdf.adapters.local_data import local_policies
-from osdf.optimizers.placementopt.conductor.remote_opt_processor import process_placement_opt
from osdf.utils.interfaces import json_from_file, yaml_from_file
@@ -29,12 +30,12 @@ class TestProcessPlacementOpt(unittest.TestCase):
def setUp(self):
mock_req_accept_message = Response("Accepted Request", content_type='application/json; charset=utf-8')
- self.patcher_req = patch('osdf.optimizers.placementopt.conductor.conductor.request',
+ self.patcher_req = patch('apps.placement.optimizers.conductor.conductor.request',
return_value={"solutionInfo": {"placementInfo": "dummy"}})
self.patcher_req_accept = patch('osdf.operation.responses.osdf_response_for_request_accept',
return_value=mock_req_accept_message)
self.patcher_callback = patch(
- 'osdf.optimizers.placementopt.conductor.remote_opt_processor.process_placement_opt',
+ 'apps.placement.optimizers.conductor.remote_opt_processor.process_placement_opt',
return_value=mock_req_accept_message)
self.patcher_RestClient = patch(
'osdf.utils.interfaces.RestClient', return_value=mock.MagicMock())
diff --git a/test/test_so_response_gen.py b/test/test_so_response_gen.py
index ab73ef6..6705cc8 100644
--- a/test/test_so_response_gen.py
+++ b/test/test_so_response_gen.py
@@ -16,10 +16,9 @@
# -------------------------------------------------------------------------
#
import unittest
-import json
-import yaml
+
+from apps.placement.optimizers.conductor.conductor import conductor_response_processor
from osdf.utils.interfaces import json_from_file
-from osdf.optimizers.placementopt.conductor.conductor import conductor_response_processor
from osdf.utils.interfaces import RestClient