summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py8
-rw-r--r--test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json237
-rw-r--r--test/csit/tests/optf-has/has/optf_has_test.robot35
-rw-r--r--test/mocks/pnfsimulator/README.md2
-rw-r--r--test/mocks/pnfsimulator/docker-compose.yml3
-rw-r--r--test/mocks/pnfsimulator/json_schema/input_validator.json2
6 files changed, 282 insertions, 5 deletions
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
index 7c52f5430..6a95c71e5 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -23,16 +23,16 @@ class PrhLibrary(object):
json_to_python = json.loads(json_file)
ipv4 = json_to_python["event"]["pnfRegistrationFields"]["oamV4IpAddress"]
ipv6 = json_to_python["event"]["pnfRegistrationFields"]["oamV6IpAddress"]
- header = json_to_python["event"]["commonEventHeader"]["sourceName"]
- str_json = '{"sourceName":"' + header + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
+ correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
+ str_json = '{"correlationId":"' + correlationId + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}'
python_to_json = json.dumps(str_json)
return python_to_json.replace("\\", "")[1:-1]
@staticmethod
def create_pnf_name(json_file):
json_to_python = json.loads(json_file)
- header = json_to_python["event"]["commonEventHeader"]["sourceName"]
- return header
+ correlationId = json_to_python["event"]["commonEventHeader"]["sourceName"]
+ return correlationId
@staticmethod
def stop_aai():
diff --git a/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json b/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json
new file mode 100644
index 000000000..55536f3c0
--- /dev/null
+++ b/test/csit/tests/optf-has/has/data/plan_with_hpa_score_multi_objective.json
@@ -0,0 +1,237 @@
+{
+ "name": "vCPE-HPA-Requirement-Optional",
+ "template": {
+ "homing_template_version": "2017-10-10",
+ "parameters": {
+ "service_name": "Residential vCPE",
+ "service_id": "vcpe_service_id",
+ "customer_lat": 45.395968,
+ "customer_long": -71.135344,
+ "REQUIRED_MEM": 4,
+ "REQUIRED_DISK": 100,
+ "pnf_id": "some_pnf_id"
+ },
+ "locations": {
+ "customer_loc": {
+ "latitude": {
+ "get_param": "customer_lat"
+ },
+ "longitude": {
+ "get_param": "customer_long"
+ }
+ }
+ },
+ "demands": {
+ "vG": [
+ {
+ "inventory_provider": "aai",
+ "inventory_type": "cloud"
+ }
+ ]
+ },
+ "constraints": {
+ "constraint_vg_customer": {
+ "type": "distance_to_location",
+ "demands": [
+ "vG"
+ ],
+ "properties": {
+ "distance": "< 100 km",
+ "location": "customer_loc"
+ }
+ },
+ "hpa_constraint": {
+ "type": "hpa",
+ "demands": [
+ "vG"
+ ],
+ "properties": {
+ "evaluate": [
+ {
+ "flavorLabel": "flavor_label_1",
+ "flavorProperties": [
+ {
+ "hpa-feature": "basicCapabilities",
+ "hpa-version": "v1",
+ "architecture": "generic",
+ "mandatory": "True",
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": "4",
+ "operator": ">="
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": "8",
+ "operator": ">=",
+ "unit": "GB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "instructionSetExtensions",
+ "hpa-version": "v1",
+ "architecture": "Intel64",
+ "mandatory": "True",
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "instructionSetExtensions",
+ "hpa-attribute-value": [
+ "aes",
+ "sse",
+ "avx",
+ "smt"
+ ],
+ "operator": "ALL",
+ "unit": ""
+ }
+ ]
+ },
+ {
+ "hpa-feature": "numa",
+ "hpa-version": "v1",
+ "architecture": "generic",
+ "mandatory": "False",
+ "score": "3",
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numaNodes",
+ "hpa-attribute-value": "2",
+ "operator": "="
+ },
+ {
+ "hpa-attribute-key": "numaCpu-0",
+ "hpa-attribute-value": "2",
+ "operator": "="
+ },
+ {
+ "hpa-attribute-key": "numaCpu-1",
+ "hpa-attribute-value": "4",
+ "operator": "="
+ },
+ {
+ "hpa-attribute-key": "numaMem-0",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": "GB"
+ },
+ {
+ "hpa-attribute-key": "numaMem-1",
+ "hpa-attribute-value": "4",
+ "operator": "=",
+ "unit": "GB"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "flavorLabel": "flavor_label_2",
+ "flavorProperties": [
+ {
+ "hpa-feature": "basicCapabilities",
+ "hpa-version": "v1",
+ "architecture": "generic",
+ "mandatory": "True",
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numVirtualCpu",
+ "hpa-attribute-value": "4",
+ "operator": ">="
+ },
+ {
+ "hpa-attribute-key": "virtualMemSize",
+ "hpa-attribute-value": "8",
+ "operator": ">=",
+ "unit": "GB"
+ }
+ ]
+ },
+ {
+ "hpa-feature": "ovsDpdk",
+ "hpa-version": "v1",
+ "architecture": "generic",
+ "mandatory": "False",
+ "score": "5",
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "dataProcessingAccelerationLibrary",
+ "hpa-attribute-value": "v18.02",
+ "operator": "="
+ }
+ ]
+ },
+ {
+ "hpa-feature": "numa",
+ "hpa-version": "v1",
+ "architecture": "generic",
+ "mandatory": "False",
+ "score": "3",
+ "hpa-feature-attributes": [
+ {
+ "hpa-attribute-key": "numaNodes",
+ "hpa-attribute-value": "2",
+ "operator": "="
+ },
+ {
+ "hpa-attribute-key": "numaCpu-0",
+ "hpa-attribute-value": "2",
+ "operator": "="
+ },
+ {
+ "hpa-attribute-key": "numaCpu-1",
+ "hpa-attribute-value": "4",
+ "operator": "="
+ },
+ {
+ "hpa-attribute-key": "numaMem-0",
+ "hpa-attribute-value": "2",
+ "operator": "=",
+ "unit": "GB"
+ },
+ {
+ "hpa-attribute-key": "numaMem-1",
+ "hpa-attribute-value": "4",
+ "operator": "=",
+ "unit": "GB"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ "optimization": {
+ "minimize": {
+ "sum": [
+ {
+ "product": [
+ 100,
+ {
+ "distance_between": [
+ "customer_loc",
+ "vG"
+ ]
+ }
+ ]
+ },
+ {
+ "product": [
+ 200,
+ {
+ "hpa_score": [
+ "vG"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ "timeout": 5,
+ "limit": 3
+}
diff --git a/test/csit/tests/optf-has/has/optf_has_test.robot b/test/csit/tests/optf-has/has/optf_has_test.robot
index deba6470e..3b3ee7a0e 100644
--- a/test/csit/tests/optf-has/has/optf_has_test.robot
+++ b/test/csit/tests/optf-has/has/optf_has_test.robot
@@ -482,6 +482,41 @@ GetPlanWithHpaUnmatched
Should Be Equal As Integers ${resp.status_code} 200
Should Be Equal not found ${resultStatus}
+# HPA Score Multi objective Optimization
+SendPlanWithHpaScoreMultiObj
+ [Documentation] It sends a POST request to conductor
+ Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
+ ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_hpa_score_multi_objective.json
+ &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
+ ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers}
+ Log To Console *********************
+ Log To Console response = ${resp}
+ Log To Console body = ${resp.text}
+ ${response_json} json.loads ${resp.content}
+ ${generatedPlanId}= Convert To String ${response_json['id']}
+ Set Global Variable ${generatedPlanId}
+ Log To Console generatedPlanId = ${generatedPlanId}
+ Should Be Equal As Integers ${resp.status_code} 201
+ Sleep 60s Wait Plan Resolution
+
+GetPlanWithHpaScoreMultiObj
+ [Documentation] It sends a REST GET request to capture recommendations
+ Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT}
+ &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
+ ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers}
+ Log To Console *********************
+ Log To Console response = ${resp}
+ ${response_json} json.loads ${resp.content}
+ ${resultStatus}= Convert To String ${response_json['plans'][0]['status']}
+ ${vim-id}= Convert To String ${response_json['plans'][0]['recommendations'][0]['vG']['candidate']['vim-id']}
+ # ${hpa_score}= Convert To String ${response_json['plans'][0]['recommendations']['vG']['hpa_score']}
+ Set Global Variable ${resultStatus}
+ Log To Console resultStatus = ${resultStatus}
+ Log To Console body = ${resp.text}
+ Should Be Equal As Integers ${resp.status_code} 200
+ Should Be Equal done ${resultStatus}
+ Should Be Equal HPA-cloud_cloud-region-1 ${vim-id}
+
*** Keywords ***
diff --git a/test/mocks/pnfsimulator/README.md b/test/mocks/pnfsimulator/README.md
index aaed3cf1c..b1ff56035 100644
--- a/test/mocks/pnfsimulator/README.md
+++ b/test/mocks/pnfsimulator/README.md
@@ -14,6 +14,7 @@ The configuration for simulator is stored in */config/config.json* file.
It contains all parameters for simulation such as duration time,interval between messages and values of the configurable fields of VES message.
If you want to change duration or value of message sending to VES collector you just need to edit this file.
The message that is being sent to VES is built inside the simulator and it's content can be found in log of the simulator.
+Proper config must contain *simulatorParams*, *commonEventHeaderParams* and *pnfRegistrationParams* or notificationParams.
###Running simulator
The recommended way is to checkout PNF Simulator project from ONAP Git repository and use *simulator*.sh script
@@ -32,6 +33,7 @@ Connection to SFTP server is being done with usage of SSH keys. Private key is s
In order to download *sftp-file.txt* file simply run *sftp -P 2222 -i ssh/ssh_host_rsa_key sftp-user@localhost:sftp/sftp-file.txt*
In order to add a new file (e.g. test.zip), put the file into *sftp* directory and run simulator.
After that again execute sftp command: *sftp -P 2222 -i ssh/ssh_host_rsa_key sftp-user@localhost:sftp/test.zip*
+In order to disable usage of SSH keys and start using password, change in *docker-compose.yml* service *sftp-service* entry *command* from *sftp-user::1001* to *sftp-user:password:1001*
###FTPES support
PNF Simulator allows to serve files via FTPES server. FTPES server has predefined user: onap with password: pano.
diff --git a/test/mocks/pnfsimulator/docker-compose.yml b/test/mocks/pnfsimulator/docker-compose.yml
index aa9f00191..f3500d248 100644
--- a/test/mocks/pnfsimulator/docker-compose.yml
+++ b/test/mocks/pnfsimulator/docker-compose.yml
@@ -27,6 +27,7 @@ services:
restart: on-failure
depends_on:
- sftp-server
+ - ftpes-server
sftp-server:
container_name: sftp-server
@@ -40,8 +41,8 @@ services:
command: sftp-user::1001
ftpes-server:
- image: stilliard/pure-ftpd:latest
container_name: ftpes-server
+ image: stilliard/pure-ftpd:latest
ports:
- "2221:21"
# - "30000-30009:30000-30009"
diff --git a/test/mocks/pnfsimulator/json_schema/input_validator.json b/test/mocks/pnfsimulator/json_schema/input_validator.json
index d278bfc87..f5573af49 100644
--- a/test/mocks/pnfsimulator/json_schema/input_validator.json
+++ b/test/mocks/pnfsimulator/json_schema/input_validator.json
@@ -190,12 +190,14 @@
{
"required": [
"simulatorParams",
+ "commonEventHeaderParams",
"pnfRegistrationParams"
]
},
{
"required": [
"simulatorParams",
+ "commonEventHeaderParams",
"notificationParams"
]
}