summaryrefslogtreecommitdiffstats
path: root/src/test/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/resources')
-rw-r--r--src/test/resources/clds/sdc-controller-config-NULL.json5
-rw-r--r--src/test/resources/clds/sdc-controller-config-TLS.json7
-rw-r--r--src/test/resources/clds/sdc-controller-config-bad.json2
-rw-r--r--src/test/resources/clds/sdc-controller-config-empty-encrypted.json14
-rw-r--r--src/test/resources/clds/sdc-controllers-config.json11
-rw-r--r--src/test/resources/clds/templates/ui-alarm-default.json2
-rw-r--r--src/test/resources/example/sdc/service-Simsfoimap0112.csarbin51391 -> 49933 bytes
-rw-r--r--src/test/resources/http-cache/example/pdp/api/deletePolicy/.file1
-rw-r--r--src/test/resources/http-cache/example/pdp/api/deletePolicy/.header1
-rwxr-xr-xsrc/test/resources/http-cache/start_http_cache.sh33
-rwxr-xr-xsrc/test/resources/http-cache/third_party_proxy.py110
11 files changed, 148 insertions, 38 deletions
diff --git a/src/test/resources/clds/sdc-controller-config-NULL.json b/src/test/resources/clds/sdc-controller-config-NULL.json
index 5c8ec0cfe..bf310c706 100644
--- a/src/test/resources/clds/sdc-controller-config-NULL.json
+++ b/src/test/resources/clds/sdc-controller-config-NULL.json
@@ -3,8 +3,9 @@
"consumerGroup": "NULL",
"consumerId": "consumerId",
"environmentName": "environmentName",
- "sdcAddress": "hostname",
+ "sdcAddress": "hostname:8080",
"password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
"pollingInterval":10,
- "pollingTimeout":30
+ "pollingTimeout":30,
+ "messageBusAddresses":["localhost"]
}
diff --git a/src/test/resources/clds/sdc-controller-config-TLS.json b/src/test/resources/clds/sdc-controller-config-TLS.json
index d7642e6b1..99366b765 100644
--- a/src/test/resources/clds/sdc-controller-config-TLS.json
+++ b/src/test/resources/clds/sdc-controller-config-TLS.json
@@ -3,11 +3,12 @@
"consumerGroup": "consumerGroup",
"consumerId": "consumerId",
"environmentName": "environmentName",
- "sdcAddress": "hostname",
+ "sdcAddress": "hostname:8080",
"password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
"pollingInterval":10,
"pollingTimeout":30,
"activateServerTLSAuth": true,
- "keyStorePassword":"bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
- "keyStorePath": "/test"
+ "keyStorePassword":"bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
+ "keyStorePath": "/test",
+ "messageBusAddresses":["localhost"]
}
diff --git a/src/test/resources/clds/sdc-controller-config-bad.json b/src/test/resources/clds/sdc-controller-config-bad.json
index d99ed5801..194ff5f4b 100644
--- a/src/test/resources/clds/sdc-controller-config-bad.json
+++ b/src/test/resources/clds/sdc-controller-config-bad.json
@@ -5,7 +5,7 @@
"consumerGroup": "consumerGroup",
"consumerId": "consumerId",
"environmentName": "environmentName",
- "sdcAddress": "hostname1",
+ "sdcAddress": "hostname1:8080",
"pollingInterval": 10,
"pollingTimeout": 30
}
diff --git a/src/test/resources/clds/sdc-controller-config-empty-encrypted.json b/src/test/resources/clds/sdc-controller-config-empty-encrypted.json
new file mode 100644
index 000000000..2a70b9edc
--- /dev/null
+++ b/src/test/resources/clds/sdc-controller-config-empty-encrypted.json
@@ -0,0 +1,14 @@
+{
+ "user": "User",
+ "consumerGroup": "consumerGroup",
+ "consumerId": "consumerId",
+ "environmentName": "environmentName",
+ "sdcAddress": "hostname:8080",
+ "password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
+ "pollingInterval":10,
+ "pollingTimeout":30,
+ "activateServerTLSAuth": true,
+ "keyStorePassword":"",
+ "keyStorePath": "/test",
+ "messageBusAddresses":["localhost"]
+}
diff --git a/src/test/resources/clds/sdc-controllers-config.json b/src/test/resources/clds/sdc-controllers-config.json
index df73a504f..ce56fef27 100644
--- a/src/test/resources/clds/sdc-controllers-config.json
+++ b/src/test/resources/clds/sdc-controllers-config.json
@@ -5,21 +5,22 @@
"consumerGroup": "consumerGroup1",
"consumerId": "consumerId1",
"environmentName": "environmentName1",
- "sdcAddress": "hostname1",
+ "sdcAddress": "localhost:${docker.http-cache.port.host}",
"password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
"pollingInterval":10,
- "pollingTimeout":30
-
+ "pollingTimeout":30,
+ "messageBusAddresses":["localhost"]
},
"sdc-controller2":{
"user": "User2",
"consumerGroup": "consumerGroup2",
"consumerId": "consumerId2",
"environmentName": "environmentName2",
- "sdcAddress": "hostname2",
+ "sdcAddress": "localhost:${docker.http-cache.port.host}",
"password": "bb3871669d893c7fb8aaacda31b77b4f537E67A081C2726889548ED7BC4C2DE6",
"pollingInterval":10,
- "pollingTimeout":30
+ "pollingTimeout":30,
+ "messageBusAddresses":["localhost"]
}
}
diff --git a/src/test/resources/clds/templates/ui-alarm-default.json b/src/test/resources/clds/templates/ui-alarm-default.json
index 0d0835981..c851e6cdd 100644
--- a/src/test/resources/clds/templates/ui-alarm-default.json
+++ b/src/test/resources/clds/templates/ui-alarm-default.json
@@ -267,7 +267,7 @@
"jnxSpaceSNAProcessUp": "vDBE-EMS-Juniper: jnxSpaceSNAProcessUp",
"jnxSpaceNodeDown": "vDBE-EMS-Juniper: jnxSpaceNodeDown",
"jnxSpaceNodeUp": "vDBE-EMS-Juniper: jnxSpaceNodeUp",
- " jnxSpaceNodeRemoval": "vDBE-EMS-Juniper: jnxSpaceNodeRemoval",
+ "jnxSpaceNodeRemoval": "vDBE-EMS-Juniper: jnxSpaceNodeRemoval",
"jnxCmCfgChange": "vDBE-Juniper: jnxCmCfgChange",
"jnxCmRescueChange": "vDBE-Juniper: jnxCmRescueChange",
"jnxEventTrap": "vDBE-Juniper: jnxEventTrap",
diff --git a/src/test/resources/example/sdc/service-Simsfoimap0112.csar b/src/test/resources/example/sdc/service-Simsfoimap0112.csar
index 160c8f2cc..fac487cec 100644
--- a/src/test/resources/example/sdc/service-Simsfoimap0112.csar
+++ b/src/test/resources/example/sdc/service-Simsfoimap0112.csar
Binary files differ
diff --git a/src/test/resources/http-cache/example/pdp/api/deletePolicy/.file b/src/test/resources/http-cache/example/pdp/api/deletePolicy/.file
new file mode 100644
index 000000000..0637a088a
--- /dev/null
+++ b/src/test/resources/http-cache/example/pdp/api/deletePolicy/.file
@@ -0,0 +1 @@
+[] \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/pdp/api/deletePolicy/.header b/src/test/resources/http-cache/example/pdp/api/deletePolicy/.header
new file mode 100644
index 000000000..6a280d972
--- /dev/null
+++ b/src/test/resources/http-cache/example/pdp/api/deletePolicy/.header
@@ -0,0 +1 @@
+{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/start_http_cache.sh b/src/test/resources/http-cache/start_http_cache.sh
index fe9e9911f..fb4975e54 100755
--- a/src/test/resources/http-cache/start_http_cache.sh
+++ b/src/test/resources/http-cache/start_http_cache.sh
@@ -22,16 +22,31 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
###
-if [ $# -eq 1 ]
- then
- echo 'input parameter is set (proxy http)';
- export http_proxy=$1
- export https_proxy=$1
- else
- echo 'input parameter is not set (proxy http)';
-fi
+echo "Starting HTTP CACHE python script"
+for i in "$@"
+do
+case $i in
+ --python_proxyaddress=*)
+ python_proxyaddress="--proxyaddress ${i#*=}"
+ echo "- Using python_proxyaddress and set it to: $python_proxyaddress"
+ shift # past argument=value
+ ;;
+ --http_proxyaddress=*)
+ export http_proxy="${i#*=}"
+ export https_proxy="${i#*=}"
+ echo "- Defining http_proxy/https_proxy env variables to: $http_proxy"
+ shift # past argument=value
+ ;;
+ -?|--help|-help)
+ echo "Usage: $(basename $0) [--http_proxyaddress=<http://proxy_address:port>] [--python_proxyaddress=<python_simulator_address:port>]"
+ echo "--http_proxyaddress Set the http_proxy/https_proxy in the script before running python"
+ echo "--python_proxyaddress <python_simulator_address:port>, like localhost:8080 and will be set as --proxyaddress, this is the adress returned by DCAE simulator response"
+ exit 2
+ ;;
+esac
+done
echo 'Installing requests packages for Python'
pip install requests
echo 'Executing the Http proxy in Cache mode only'
-python third_party_proxy.py --port 8080 --root /usr/src/http-cache-app/data-cache
+python third_party_proxy.py --port 8080 --root /usr/src/http-cache-app/data-cache $python_proxyaddress
diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py
index 72ea49587..29d34cc89 100755
--- a/src/test/resources/http-cache/third_party_proxy.py
+++ b/src/test/resources/http-cache/third_party_proxy.py
@@ -41,6 +41,7 @@ parser.add_argument("--root", "-r", default=tempfile.mkdtemp, type=str, help
parser.add_argument("--proxy" , type=str, help="Url of the Act as a proxy. If not set, this script only uses the cache and will return a 404 if files aren't found")
parser.add_argument("--port", "-P", type=int, default="8081", help="Port on which the proxy should listen to")
parser.add_argument("--verbose", "-v", type=bool, help="Print more information in case of error")
+parser.add_argument("--proxyaddress","-a", type=str, help="Address of this proxy, generally either third_party_proxy:8085 or localhost:8085 depending if started with docker-compose or not")
options = parser.parse_args()
@@ -49,6 +50,7 @@ HOST = options.proxy
AUTH = (options.username, options.password)
HEADERS = {'X-ECOMP-InstanceID':'CLAMP'}
CACHE_ROOT = options.root
+PROXY_ADDRESS=options.proxyaddress
def signal_handler(signal_sent, frame):
global httpd
@@ -116,7 +118,17 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
os.makedirs(cached_file, True)
with open(cached_file_header, 'w') as f:
- f.write("{\"Content-Length\": \"144\", \"Content-Type\": \"application/json\"}")
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ elif self.path.startswith("/dcae-operationstatus"):
+ print "self.path start with /dcae-operationstatus, generating response json..."
+ jsonGenerated = "{\"operationType\": \"operationType1\", \"status\": \"succeeded\"}"
+ print "jsonGenerated: " + jsonGenerated
+
+ os.makedirs(cached_file, True)
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
with open(cached_file_content, 'w') as f:
f.write(jsonGenerated)
else:
@@ -215,27 +227,91 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
cached_file_header = "%s/.header" % (cached_file,)
_file_available = os.path.exists(cached_file_content)
- if not _file_available and not HOST:
- print("No file corresponding in cache and no HOST specified: %s" % HOST)
- self.send_response(404)
- return "404 Not found"
if not _file_available:
- print("Request for data currently not present in cache: %s" % (cached_file,))
+ if self.path.startswith("/dcae-deployments/"):
+ print "self.path start with /dcae-deployments/, generating response json..."
+ #jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus\",\"test2\":\"test2\"}}"
+ print "jsonGenerated: " + jsonGenerated
+
+ os.makedirs(cached_file, True)
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ else:
+ if not HOST:
+ self.send_response(404)
+ return "404 Not found"
+
+ print("Request for data currently not present in cache: %s" % (cached_file,))
+
+ url = '%s%s' % (HOST, self.path)
+ print("url: %s" % (url,))
+ response = requests.put(url, data=self.data_string, headers=self.headers, stream=True)
+
+ if response.status_code == 200:
+ self._write_cache(cached_file, cached_file_header, cached_file_content, response)
+ else:
+ print('Error when requesting file :')
+ print('Requested url : %s' % (url,))
+ print('Status code : %s' % (response.status_code,))
+ print('Content : %s' % (response.content,))
+ self.send_response(response.status_code)
+ return response.content
+ else:
+ print("Request for data present in cache: %s" % (cached_file,))
+
+ self._send_content(cached_file_header, cached_file_content)
- url = '%s%s' % (HOST, self.path)
- print("url: %s" % (url,))
- response = requests.put(url, data=self.data_string, headers=self.headers, stream=True)
- if response.status_code == 200:
- self._write_cache(cached_file, cached_file_header, cached_file_content, response)
+ def do_DELETE(self):
+ print("\n\n\nGot a DELETE for %s " % self.path)
+ self.check_credentials()
+ print("self.headers:\n %s" % self.headers)
+
+ cached_file = '%s/%s' % (CACHE_ROOT, self.path,)
+ print("Cached file name before escaping : %s" % cached_file)
+ cached_file = cached_file.replace('<','&#60;').replace('>','&#62;').replace('?','&#63;').replace('*','&#42;').replace('\\','&#42;').replace(':','&#58;').replace('|','&#124;')
+ print("Cached file name after escaping (used for cache storage) : %s" % cached_file)
+ cached_file_content = "%s/.file" % (cached_file,)
+ cached_file_header = "%s/.header" % (cached_file,)
+
+ _file_available = os.path.exists(cached_file_content)
+
+ if not _file_available:
+ if self.path.startswith("/dcae-deployments/"):
+ print "self.path start with /dcae-deployments/, generating response json..."
+ #jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus\",\"test2\":\"test2\"}}"
+ print "jsonGenerated: " + jsonGenerated
+
+ os.makedirs(cached_file, True)
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
else:
- print('Error when requesting file :')
- print('Requested url : %s' % (url,))
- print('Status code : %s' % (response.status_code,))
- print('Content : %s' % (response.content,))
- self.send_response(response.status_code)
- return response.content
+ if not HOST:
+ self.send_response(404)
+ return "404 Not found"
+
+ print("Request for data currently not present in cache: %s" % (cached_file,))
+
+ url = '%s%s' % (HOST, self.path)
+ print("url: %s" % (url,))
+ response = requests.put(url, data=self.data_string, headers=self.headers, stream=True)
+
+ if response.status_code == 200:
+ self._write_cache(cached_file, cached_file_header, cached_file_content, response)
+ else:
+ print('Error when requesting file :')
+ print('Requested url : %s' % (url,))
+ print('Status code : %s' % (response.status_code,))
+ print('Content : %s' % (response.content,))
+ self.send_response(response.status_code)
+ return response.content
else:
print("Request for data present in cache: %s" % (cached_file,))