aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/tests/dcaegen2/testcases/resources
diff options
context:
space:
mode:
Diffstat (limited to 'test/csit/tests/dcaegen2/testcases/resources')
-rw-r--r--test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py32
-rwxr-xr-xtest/csit/tests/dcaegen2/testcases/resources/collector.properties74
-rw-r--r--test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot48
-rw-r--r--test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot8
-rwxr-xr-xtest/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh23
5 files changed, 140 insertions, 45 deletions
diff --git a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py
index 650f8fef8..0242ad7ab 100644
--- a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py
+++ b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py
@@ -5,14 +5,14 @@ Created on Aug 18, 2017
'''
from robot.api import logger
from Queue import Queue
-import uuid, time, datetime,json, threading
+import uuid, time, datetime,json, threading,os, platform, subprocess,paramiko
import DcaeVariables
import DMaaP
class DcaeLibrary(object):
def __init__(self):
- pass
+ pass
def setup_dmaap_server(self, portNum=3904):
if DcaeVariables.HttpServerThread != None:
@@ -50,6 +50,28 @@ class DcaeLibrary(object):
return "true"
logger.console("DMaaP server not started yet")
return "false"
+
+ def enable_vesc_https_auth(self):
+ if 'Windows' in platform.system():
+ try:
+ client = paramiko.SSHClient()
+ client.load_system_host_keys()
+ #client.set_missing_host_key_policy(paramiko.WarningPolicy)
+ client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+
+ client.connect(os.environ['CSIT_IP'], port=22, username=os.environ['CSIT_USER'], password=os.environ['CSIT_PD'])
+ stdin, stdout, stderr = client.exec_command('%{WORKSPACE}/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh')
+ logger.console(stdout.read())
+ finally:
+ client.close()
+ return
+ ws = os.environ['WORKSPACE']
+ script2run = ws + "/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh"
+ logger.info("Running script: " + script2run)
+ logger.console("Running script: " + script2run)
+ subprocess.call(script2run)
+ time.sleep(5)
+ return
def dmaap_message_receive(self, evtobj, action='contain'):
@@ -129,7 +151,9 @@ if __name__ == '__main__':
'''
lib = DcaeLibrary()
+ lib.enable_vesc_https_auth()
+
ret = lib.setup_dmaap_server()
print ret
- time.sleep(10000000000)
- \ No newline at end of file
+ time.sleep(100000)
+
diff --git a/test/csit/tests/dcaegen2/testcases/resources/collector.properties b/test/csit/tests/dcaegen2/testcases/resources/collector.properties
new file mode 100755
index 000000000..1c5c8411e
--- /dev/null
+++ b/test/csit/tests/dcaegen2/testcases/resources/collector.properties
@@ -0,0 +1,74 @@
+###############################################################################
+##
+## Collector Server config
+##
+## - Default values are shown as commented settings.
+##
+###############################################################################
+##
+## HTTP(S) service
+##
+## Normally:
+##
+## - 8080 is http service
+## - https is disabled by default (-1)
+##
+## - At this time, the server always binds to 0.0.0.0
+##
+## The default port when header.authflag is disabled (0)
+#collector.service.port=8080
+
+## The secure port is required if header.authflag is set to 1 (true)
+## Authentication is only supported via secure port
+## When enabled - require valid keystore defined
+collector.service.secure.port=8443
+
+## The keystore must be setup per installation when secure port is configured
+collector.keystore.file.location=../etc/keystore
+collector.keystore.passwordfile=./etc/passwordfile
+collector.keystore.alias=tomcat
+
+
+###############################################################################
+## Processing
+##
+## If there's a problem that prevents the collector from processing alarms,
+## it's normally better to apply back pressure to the caller than to try to
+## buffer beyond a reasonable size limit. With a limit, the server won't crash
+## due to being out of memory, and the caller will get a 5xx reply saying the
+## server is in trouble.
+collector.inputQueue.maxPending=8096
+
+## Schema Validation checkflag
+## default no validation checkflag (-1)
+## If enabled (1) - schemafile location must be specified
+collector.schema.checkflag=1
+collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.3.json\"}
+
+## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile
+collector.dmaap.streamid=fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling
+collector.dmaapfile=./etc/DmaapConfig.json
+
+## Custom ExceptionConfiguration
+exceptionConfig=./etc/ExceptionConfig.json
+
+## authflag control authentication by the collector
+## If enabled (1) - then authlist has to be defined
+## When authflag is enabled, only secure port will be supported
+## To disable enter 0
+header.authflag=1
+## Combination of userid,base64 encoded pwd list to be supported
+## userid and pwd comma separated; pipe delimitation between each pair
+header.authlist=sample1,c2FtcGxlMQ==|vdnsagg,dmRuc2FnZw==
+
+## Event transformation Flag - when set expects configurable transformation
+## defined under ./etc/eventTransform.json
+## Enabled by default; to disable set to 0
+event.transform.flag=0
+
+###############################################################################
+##
+## Tomcat control
+##
+#tomcat.maxthreads=(tomcat default, which is usually 200)
+
diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot
index a30a1ba01..59d44e158 100644
--- a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot
+++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot
@@ -1,16 +1,13 @@
*** Settings ***
Documentation The main interface for interacting with DCAE. It handles low level stuff like managing the http request library and DCAE required fields
Library RequestsLibrary
-Library DcaeLibrary.py
+Library DcaeLibrary
Library OperatingSystem
Library Collections
Variables ../resources/DcaeVariables.py
Resource ../resources/dcae_properties.robot
-
-
*** Variables ***
${DCAE_HEALTH_CHECK_BODY} %{WORKSPACE}/test/csit/tests/dcae/testcases/assets/json_events/dcae_healthcheck.json
-
*** Keywords ***
Get DCAE Nodes
[Documentation] Get DCAE Nodes from Consul Catalog
@@ -26,8 +23,6 @@ Get DCAE Nodes
${len}= Get Length ${NodeList}
Should Not Be Equal As Integers ${len} 0
[return] ${NodeList}
-
-
DCAE Node Health Check
[Documentation] Perform DCAE Node Health Check
[Arguments] ${NodeName}
@@ -43,76 +38,58 @@ DCAE Node Health Check
Should Not Be Equal As Integers ${len} 0
DCAE Check Health Status ${NodeName} ${StatusList[0]} Serf Health Status
#Run Keyword if ${len} > 1 DCAE Check Health Status ${NodeName} ${StatusList[1]} Serf Health Status
-
-
DCAE Check Health Status
[Arguments] ${NodeName} ${ItemStatus} ${CheckType}
Should Be Equal As Strings ${ItemStatus} passing
Log Node: ${NodeName} ${CheckType} check pass ok
-
VES Collector Suite Setup DMaaP
[Documentation] Start DMaaP Mockup Server
${ret}= Setup DMaaP Server
Should Be Equal As Strings ${ret} true
-
VES Collector Suite Shutdown DMaaP
[Documentation] Shutdown DMaaP Mockup Server
${ret}= Shutdown DMaap
Should Be Equal As Strings ${ret} true
-
-
-
-
Check DCAE Results
[Documentation] Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN
[Arguments] ${json}
@{rows}= Get From Dictionary ${json['returns']} rows
@{headers}= Get From Dictionary ${json['returns']} columns
-
# Retrieve column names from headers
${columns}= Create List
:for ${header} in @{headers}
- \ ${colName}= Get From Dictionary ${header} colName
+ \ ${colName}= Get From Dictionary ${header} colName
\ Append To List ${columns} ${colName}
-
- # Process each row making sure status=GREEN
+ # Process each row making sure status=GREEN
:for ${row} in @{rows}
\ ${cells}= Get From Dictionary ${row} cells
- \ ${dict}= Make A Dictionary ${cells} ${columns}
+ \ ${dict}= Make A Dictionary ${cells} ${columns}
\ Dictionary Should Contain Item ${dict} healthTestStatus GREEN
-
-
Make A Dictionary
[Documentation] Given a list of column names and a list of dictionaries, map columname=value
[Arguments] ${columns} ${names} ${valuename}=value
${dict}= Create Dictionary
- ${collength}= Get Length ${columns}
- ${namelength}= Get Length ${names}
+ ${collength}= Get Length ${columns}
+ ${namelength}= Get Length ${names}
:for ${index} in range 0 ${collength}
\ ${name}= Evaluate ${names}[${index}]
\ ${valued}= Evaluate ${columns}[${index}]
\ ${value}= Get From Dictionary ${valued} ${valueName}
\ Set To Dictionary ${dict} ${name} ${value}
[Return] ${dict}
-
-
Get Event Data From File
[Arguments] ${jsonfile}
${data}= OperatingSystem.Get File ${jsonfile}
#Should Not Be_Equal ${data} None
[return] ${data}
-
Json String To Dictionary
[Arguments] ${json_string}
${json_dict}= evaluate json.loads('''${json_string}''') json
[return] ${json_dict}
-
Dictionary To Json String
[Arguments] ${json_dict}
${json_string}= evaluate json.dumps(${json_dict}) json
[return] ${json_string}
-
-
Get DCAE Service Component Status
[Documentation] Get the status of a DCAE Service Component
[Arguments] ${url} ${urlpath} ${usr} ${passwd}
@@ -120,26 +97,23 @@ Get DCAE Service Component Status
${session}= Create Session dcae-service-component ${url} auth=${auth}
${resp}= Get Request dcae-service-component ${urlpath}
[return] ${resp}
-
Publish Event To VES Collector No Auth
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata}
Log Creating session ${url}
- ${session}= Create Session dcae-d1 ${url}
- ${resp}= Post Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
+ ${session}= Create Session dcaegen2-d1 ${url}
+ ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
-
Publish Event To VES Collector
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd}
${auth}= Create List ${user} ${pd}
Log Creating session ${url}
- ${session}= Create Session dcae-d1 ${url} auth=${auth}
- ${resp}= Post Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
+ ${session}= Create Session dcaegen2-d1 ${url} auth=${auth} disable_warnings=1
+ ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
-
Publish Event To VES Collector With Put Method
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd}
@@ -149,7 +123,6 @@ Publish Event To VES Collector With Put Method
${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
-
Publish Event To VES Collector With Put Method No Auth
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata}
@@ -158,4 +131,3 @@ Publish Event To VES Collector With Put Method No Auth
${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
- \ No newline at end of file
diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot
index be182d4aa..be072d73c 100644
--- a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot
+++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot
@@ -5,9 +5,11 @@ Documentation store all properties that can change or are used in multipl
*** Variables ***
-${GLOBAL_APPLICATION_ID} robot-dcae
-${GLOBAL_DCAE_CONSUL_URL} http://135.205.228.129:8500
-${GLOBAL_DCAE_CONSUL_URL1} http://135.205.228.170:8500
+${GLOBAL_APPLICATION_ID} robot-dcaegen2
+${GLOBAL_DCAE_CONSUL_URL} http://135.205.228.129:8500
+${GLOBAL_DCAE_CONSUL_URL1} http://135.205.228.170:8500
${GLOBAL_DCAE_VES_URL} http://localhost:8443/eventlistener/v5
${GLOBAL_DCAE_USERNAME} console
${GLOBAL_DCAE_PASSWORD} ZjJkYjllMjljMTI2M2Iz
+${VESC_HTTPS_USER} sample1
+${VESC_HTTPS_PD} sample1
diff --git a/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh b/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh
new file mode 100755
index 000000000..12989911b
--- /dev/null
+++ b/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Copyright 2016-2017 Huawei Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+docker exec -it vesc /opt/app/VESCollector/bin/VESrestfulCollector.sh stop
+sleep 2
+docker cp ${WORKSPACE}/test/csit/tests/dcaegen2/testcases/resources/collector.properties vesc:/opt/app/VESCollector/etc
+sleep 10
+docker exec -id vesc /opt/app/VESCollector/bin/VESrestfulCollector.sh start
+sleep 5
+echo "VES Collector Restarted"