aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/mocks/datafilecollector-testharness/dr-sim/Dockerfile18
-rw-r--r--test/mocks/datafilecollector-testharness/dr-sim/README.md6
-rw-r--r--test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js91
-rw-r--r--test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml17
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md6
-rwxr-xr-xtest/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh2
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml5
-rwxr-xr-xtest/mocks/datafilecollector-testharness/mr-sim/Dockerfile10
-rw-r--r--test/mocks/datafilecollector-testharness/mr-sim/README.md49
-rw-r--r--test/mocks/datafilecollector-testharness/mr-sim/docker-compose.yml10
-rw-r--r--test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py847
-rw-r--r--test/mocks/mass-pnf-sim/README.md12
-rwxr-xr-xtest/mocks/mass-pnf-sim/mass-pnf-sim.py37
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md14
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml4
-rwxr-xr-xtest/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh19
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java68
-rw-r--r--test/mocks/pnf-onboarding/unsecureAcmePnf.csarbin18918 -> 18917 bytes
18 files changed, 914 insertions, 301 deletions
diff --git a/test/mocks/datafilecollector-testharness/dr-sim/Dockerfile b/test/mocks/datafilecollector-testharness/dr-sim/Dockerfile
new file mode 100644
index 000000000..fc903d7e7
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/dr-sim/Dockerfile
@@ -0,0 +1,18 @@
+#Common image for both dmmapDR and dmaapDR_redir
+
+FROM node:8
+
+WORKDIR /app
+
+COPY dmaapDR.js ./
+COPY dmaapDR_redir.js ./
+COPY package*.json ./
+COPY cert/ cert/
+
+RUN npm install express
+RUN npm install argparse
+
+EXPOSE 3906
+EXPOSE 3907
+EXPOSE 3908
+EXPOSE 3909 \ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/dr-sim/README.md b/test/mocks/datafilecollector-testharness/dr-sim/README.md
index 38ad1c522..f0cdf589b 100644
--- a/test/mocks/datafilecollector-testharness/dr-sim/README.md
+++ b/test/mocks/datafilecollector-testharness/dr-sim/README.md
@@ -1,3 +1,9 @@
+#Alternative to running python (as described below) on your machine, use the docker files.
+1. Build docker container with ```docker build -t drsim_common:latest .```
+2. Run the container ```docker-compose up```
+
+
+
1. install nodejs
2. install npm
Make sure that you run these commands in the application directory "dr-sim"
diff --git a/test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js b/test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js
index cca85f98b..a1b2770cf 100644
--- a/test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js
+++ b/test/mocks/datafilecollector-testharness/dr-sim/dmaapBusController.js
@@ -6,35 +6,38 @@ const stream = require('stream');
var app = express();
var fs = require("fs");
var path = require('path');
-var privateKey = fs.readFileSync('cert/private.key', 'utf8');
+var privateKey = fs.readFileSync('cert/private.key', 'utf8');
var certificate = fs.readFileSync('cert/certificate.crt', 'utf8');
-var credentials = {key: privateKey, cert: certificate};
+var credentials = {
+ key: privateKey,
+ cert: certificate
+};
var parser = new ArgumentParser({
- version: '0.0.1',
- addHelp:true,
- description: 'Datarouter simulator'
- });
+ version: '0.0.1',
+ addHelp: true,
+ description: 'Datarouter simulator'
+});
-parser.addArgument('--tc' , { help: 'TC $NoOfTc' } );
-parser.addArgument('--printtc' ,
- {
- help: 'Print complete usage help',
- action: 'storeTrue'
- }
- );
+parser.addArgument('--tc', {
+ help: 'TC $NoOfTc'
+});
+parser.addArgument('--printtc', {
+ help: 'Print complete usage help',
+ action: 'storeTrue'
+});
var args = parser.parseArgs();
-if (args.tc=="100") {
+if (args.tc == "100") {
console.log("TC: 100")
}
-if (args.tc=="101") {
+if (args.tc == "101") {
console.log("TC: 101")
//preparations
}
-if (args.tc=="102") {
+if (args.tc == "102") {
console.log("TC: 102")
//preparations
}
@@ -47,30 +50,66 @@ if (args.printtc) {
}
var bodyParser = require('body-parser')
-app.use(bodyParser.urlencoded({ extended: false }))
+app.use(bodyParser.urlencoded({
+ extended: false
+}))
// parse application/json
app.use(bodyParser.json())
// parse application/vnd.api+json as json
-app.use(bodyParser.json({ type: 'application/vnd.api+json' }))
+app.use(bodyParser.json({
+ type: 'application/vnd.api+json'
+}))
// parse some custom thing into a Buffer
-app.use(bodyParser.raw({limit:1024*1024*20, type: 'application/octet-stream' }))
+app.use(bodyParser.raw({
+ limit: 1024 * 1024 * 20,
+ type: 'application/octet-stream'
+}))
// parse an HTML body into a string
-app.use(bodyParser.text({ type: 'text/html' }))
-app.get("/",function(req, res){
+app.use(bodyParser.text({
+ type: 'text/html'
+}))
+app.get("/", function (req, res) {
res.send("ok");
})
app.post('/webapi/feeds/', function (req, res) {
- res.send("ok");
+ res.setHeader('Content-Type', 'application/json');
+ var feedName = req.body.feedName;
+ console.log(feedName);
+ res.end(JSON.stringify({
+ "type": "feed",
+ "lastMod": "2019-03-21T16:00:40.489",
+ "status": "VALID",
+ "asprClassification": "unclassified",
+ "feedDescription": "generated for CSIT",
+ "feedId": "3",
+ "feedName": feedName,
+ "feedVersion": "csit",
+ "logURL": "https://dmaap-dr-prov/feedlog/3",
+ "owner": "dgl",
+ "publishURL": "https://dmaap-dr-prov/publish/3",
+ "pubs": [{
+ "lastMod": "2019-01-24T16:00:40.484",
+ "status": "VALID",
+ "dcaeLocationName": "san-francisco",
+ "feedId": "3",
+ "pubId": "3.4gh53",
+ "username": "tmp_i63w8psh6ycnoqu",
+ "userpwd": "6jkc1uwywrc8q4w"
+ }],
+ "subs": [],
+ "subscribeURL": "https://dmaap-dr-prov/subscribe/3",
+ "suspended": false
+ }));
})
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
-var httpPort=6665
-var httpsPort=6666
+var httpPort = 6665
+var httpsPort = 6666
httpServer.listen(httpPort);
-console.log("DR-simulator listening (http) at "+httpPort)
+console.log("DR-simulator listening (http) at " + httpPort)
httpsServer.listen(httpsPort);
-console.log("DR-simulator listening (https) at "+httpsPort) \ No newline at end of file
+console.log("DR-simulator listening (https) at " + httpsPort) \ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml b/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml
new file mode 100644
index 000000000..1ad478886
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml
@@ -0,0 +1,17 @@
+version: '2'
+services:
+ drsim:
+ image: drsim_common:latest
+ ports:
+ - "3906:3906"
+ - "3907:3907"
+ container_name: drsim
+ command: node dmaapDR.js
+
+ drsim_redir:
+ image: drsim_common:latest
+ ports:
+ - "3908:3908"
+ - "3909:3909"
+ container_name: drsim_redir
+ command: node dmaapDR_redir.js \ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md b/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md
index 5a1660126..3bd67404a 100644
--- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md
@@ -15,6 +15,12 @@ Source: https://docs.docker.com/install/linux/linux-postinstall/
then logout-login to activate it.
+###Prepare files for the simulator
+Run `prepare.sh` with an argument found in `test_cases.yml` (or add a new tc in that file) to create files (1MB, 5MB and 50MB files) and a large number of
+symbolic links to these files to simulate PM files. The files names maches the files in
+the events produced by the MR simulator. The dirs with the files will be mounted
+by the ftp containers, defined in the docker-compse file, when started
+
###Starting/stopping the FTPS/SFTP server(s)
Start: `docker-compose up`
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh b/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh
index f1146a61e..086d43a49 100755
--- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh
@@ -37,7 +37,7 @@ then
# Create symlinks
N_SYMLINKS=${nf_array[$n]}-1
- for ((l=1;l<=$N_SYMLINKS;l++))
+ for ((l=0;l<=$N_SYMLINKS;l++))
do
SYMLINK_NAME=$FILE_SIZE"MB_"$l".tar.gz"
ln -s ./$FILE_NAME $DIRECTORY/$SYMLINK_NAME
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml b/test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml
index 8dba11479..61275dfe2 100644
--- a/test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/test_cases.yml
@@ -9,3 +9,8 @@ TC2:
size_files: 0.5 1 5
number_files: 2 3 1
directory_files: ftps ftps sftp
+
+TC_10000:
+ size_files: 1 1 5 5 50 50
+ number_files: 10000 10000 10000 10000 1 1
+ directory_files: ftps sftp ftps sftp ftps sftp \ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/Dockerfile b/test/mocks/datafilecollector-testharness/mr-sim/Dockerfile
new file mode 100755
index 000000000..5341bb074
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/mr-sim/Dockerfile
@@ -0,0 +1,10 @@
+FROM python:3.6-alpine
+
+COPY . /app
+
+WORKDIR /app
+
+RUN pip install -r requirements.txt
+
+EXPOSE 2222
+
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/README.md b/test/mocks/datafilecollector-testharness/mr-sim/README.md
index b04b9ec64..57463453f 100644
--- a/test/mocks/datafilecollector-testharness/mr-sim/README.md
+++ b/test/mocks/datafilecollector-testharness/mr-sim/README.md
@@ -1,3 +1,52 @@
+
+#Alternative to running python (as described below) on your machine, use the docker files.
+1. Build docker container with ```docker build -t mrsim:latest .```
+2. Run the container ```docker-compose up```
+The behavior can be changed by argument to the python script in the docker-compose.yml
+
+The simulator can be queried for statistics
+localhost:2222/ctr_requests - return an integer of the number of get request to the event poll path
+localhost:2222/ctr_responses - return an integer of the number of get responses to the event poll path
+localhost:2222/ctr_unique_files - returns an integer or the number of unique files. A unique file is the combination of node+file_sequence_number
+
+
+##Common TC info
+File names for 1MB, 5MB and 50MB files
+Files in the format: <size-in-mb>MB_<sequence-number>.tar.gz Ex. for 5MB file with sequence number 12: 5MB_12.tar.gz
+The sequence numbers are stepped so that all files have unique names
+Missing files (files that are not expected to be found in the ftp server. Format: MissingFile_<sequence-number>.tar.gz
+
+Limited event streams
+When the number of events are exhausted, empty replies are returned '[]'
+
+TC100 - One ME, SFTP, 1 1MB file, 1 event
+TC101 - One ME, SFTP, 1 5MB file, 1 event
+TC102 - One ME, SFTP, 1 50MB file, 1 event
+
+TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.
+TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.
+TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.
+TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.
+
+
+TC120 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json
+TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files
+TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name.
+
+Endless event streams
+TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll
+TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll
+
+
+TC510 - 5 ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.
+
+
+TC200-TC202 same as TC100-TC102 but with FTPS
+TC210-TC213 same as TC110-TC113 but with FTPS
+TC2000-TC2001 same as TC1000-TC1001 but with FTPS
+TC610 same as TC510 but with FTPS
+
+
## Developer workflow
1. ```sudo apt install python3-venv```
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/docker-compose.yml b/test/mocks/datafilecollector-testharness/mr-sim/docker-compose.yml
new file mode 100644
index 000000000..7315e4be3
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/mr-sim/docker-compose.yml
@@ -0,0 +1,10 @@
+version: '2'
+
+services:
+ mrsim:
+ image: mrsim:latest
+ ports:
+ - "2222:2222"
+ container_name: mrsim
+ command: python mr-sim.py --tc100
+# Change -tc100 to other tc number for desired behavior. \ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py
index c37ae698a..ef46535f5 100644
--- a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py
+++ b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py
@@ -8,73 +8,432 @@ import json
from flask import Flask
app = Flask(__name__)
-DEFAULT_IP = "localhost"
+#Server info
+HOST_IP = "0.0.0.0"
+HOST_PORT = 2222
+#Test function to check server running
+@app.route('/',
+ methods=['GET'])
+def index():
+ return 'Hello world'
+
+#Returns number of polls
+@app.route('/ctr_requests',
+ methods=['GET'])
+def counter_requests():
+ global ctr_requests
+ return str(ctr_requests)
+#Returns number of replies
+@app.route('/ctr_responses',
+ methods=['GET'])
+def counter_responses():
+ global ctr_responses
+ return str(ctr_responses)
+
+#Returns number of unique files
+@app.route('/ctr_unique_files',
+ methods=['GET'])
+def counter_uniquefiles():
+ global fileMap
+ return str(len(fileMap))
+
+#Returns tc info
+@app.route('/tc_info',
+ methods=['GET'])
+def testcase_info():
+ global tc_num
+ return tc_num
+
+#Messages polling function
@app.route(
"/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12",
methods=['GET'])
def MR_reply():
- global mr_counter
- global mr_replies
-
- mr_counter = mr_counter + 1
- print("MR receiver counter: " + str(mr_counter))
-
- if mr_replies[mr_counter].sleepMs != 0:
- sleep(mr_replies[mr_counter].sleepMs / 1000.0)
- print("Sleeping: " + str(mr_replies[mr_counter].sleepMs) + " ms")
-
- if mr_replies[mr_counter].replytype == 0:
- #print (str(mr_replies[mr_counter].jsonreply))
- print("Regular reply")
- response = app.response_class(
- response=mr_replies[mr_counter].jsonreply,
- status=200,
- mimetype='application/json')
-
- return response
-
- if mr_replies[mr_counter].replytype == 2:
-
- print("error: 404")
- response = app.response_class(
- response="",
- status=404,
- mimetype='application/json')
-
- return response
-
- if mr_replies[mr_counter].replytype == 1:
- print("do nothing, sink request")
- return
-
-
-class Reply:
- """An instance of the reply event, which can be configured to behave in a certain way
- (delay, error code, reply body"""
-
- def to_json(self):
- return self.jsonreply
-
- def __init__(
- self,
- ip=DEFAULT_IP,
- file="1MB.tar.gz",
- sleepMs=0,
- replyType=0,
- port=1022,
- type="ftps"):
- self.sleepMs = sleepMs
- self.ip = ip
- self.file = file
- self.port = port
- self.replytype = replyType # 0 for reply, 1 timeout, 2 deny
- self.user = "onap"
- self.passwd = "pano"
- self.type = type
- self.jsonreply = str.encode("""
- [{
+ global ctr_requests
+ global args
+
+ ctr_requests = ctr_requests + 1
+ print("MR: poll request#: " + str(ctr_requests))
+
+ if args.tc100:
+ return tc100("sftp")
+ elif args.tc101:
+ return tc101("sftp")
+ elif args.tc102:
+ return tc102("sftp")
+
+ elif args.tc110:
+ return tc110("sftp")
+ elif args.tc111:
+ return tc111("sftp")
+ elif args.tc112:
+ return tc112("sftp")
+ elif args.tc113:
+ return tc113("sftp")
+
+ elif args.tc120:
+ return tc120("sftp")
+ elif args.tc121:
+ return tc121("sftp")
+ elif args.tc122:
+ return tc122("sftp")
+
+ elif args.tc1000:
+ return tc1000("sftp")
+ elif args.tc1001:
+ return tc1001("sftp")
+
+ elif args.tc510:
+ return tc510("sftp")
+
+
+ elif args.tc200:
+ return tc200("ftps")
+ elif args.tc201:
+ return tc201("ftps")
+ elif args.tc202:
+ return tc202("ftps")
+
+ elif args.tc210:
+ return tc210("ftps")
+ elif args.tc211:
+ return tc211("ftps")
+ elif args.tc212:
+ return tc212("ftps")
+ elif args.tc213:
+ return tc213("ftps")
+
+ elif args.tc220:
+ return tc220("ftps")
+ elif args.tc221:
+ return tc221("ftps")
+ elif args.tc222:
+ return tc222("ftps")
+
+ elif args.tc2000:
+ return tc2000("ftps")
+ elif args.tc2001:
+ return tc2001("ftps")
+
+ elif args.tc610:
+ return tc510("ftps")
+
+
+#### Test case functions
+
+
+def tc100(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 1):
+ return buildOkResponse("[]")
+
+ seqNr = (ctr_responses-1)
+ msg = getEventHead() + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+ fileMap[seqNr] = seqNr
+ return buildOkResponse("["+msg+"]")
+
+def tc101(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 1):
+ return buildOkResponse("[]")
+
+ seqNr = (ctr_responses-1)
+ msg = getEventHead() + getEventName("5MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+ fileMap[seqNr] = seqNr
+
+ return buildOkResponse("["+msg+"]")
+
+def tc102(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 1):
+ return buildOkResponse("[]")
+
+ seqNr = (ctr_responses-1)
+ msg = getEventHead() + getEventName("50MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+ fileMap[seqNr] = seqNr
+
+ return buildOkResponse("["+msg+"]")
+
+def tc110(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 100):
+ return buildOkResponse("[]")
+
+ seqNr = (ctr_responses-1)
+ msg = getEventHead() + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022) + getEventEnd()
+ fileMap[seqNr] = seqNr
+
+ return buildOkResponse("["+msg+"]")
+
+def tc111(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 100):
+ return buildOkResponse("[]")
+
+ msg = getEventHead()
+
+ for i in range(100):
+ seqNr = i+(ctr_responses-1)
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+ fileMap[seqNr] = seqNr
+
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+def tc112(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 100):
+ return buildOkResponse("[]")
+
+ msg = getEventHead()
+
+ for i in range(100):
+ seqNr = i+(ctr_responses-1)
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName("5MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+ fileMap[seqNr] = seqNr
+
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+def tc113(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 1):
+ return buildOkResponse("[]")
+
+ msg = ""
+
+ for evts in range(100): # build 100 evts
+ if (evts > 0):
+ msg = msg + ","
+ msg = msg + getEventHead()
+ for i in range(100): # build 100 files
+ seqNr = i+evts+100*(ctr_responses-1)
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+ fileMap[seqNr] = seqNr
+
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+
+def tc120(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 100):
+ return buildOkResponse("[]")
+
+ if (ctr_responses % 10 == 2):
+ return # Return nothing
+
+ if (ctr_responses % 10 == 3):
+ return buildOkResponse("") # Return empty message
+
+ if (ctr_responses % 10 == 4):
+ return buildOkResponse(getEventHead()) # Return part of a json event
+
+ if (ctr_responses % 10 == 5):
+ return buildEmptyResponse(404) # Return empty message with status code
+
+ if (ctr_responses % 10 == 6):
+ sleep(60)
+
+
+ msg = getEventHead()
+
+ for i in range(100):
+ seqNr = i+(ctr_responses-1)
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+ fileMap[seqNr] = seqNr
+
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+def tc121(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 100):
+ return buildOkResponse("[]")
+
+ msg = getEventHead()
+
+ for i in range(100):
+ seqNr = i+(ctr_responses-1)
+ if (seqNr%10 == 0): # Every 10th file is "missing"
+ fn = "MissingFile_" + str(seqNr) + ".tar.gz"
+ else:
+ fn = "1MB_" + str(seqNr) + ".tar.gz"
+ fileMap[seqNr] = seqNr
+
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName(fn,ftptype,"onap","pano","localhost",1022)
+
+
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+def tc122(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 100):
+ return buildOkResponse("[]")
+
+ msg = getEventHead()
+
+ for i in range(100):
+ fn = "1MB_0.tar.gz" # All files identical names
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName(fn,ftptype,"onap","pano","localhost",1022)
+
+ fileMap[0] = 0
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+
+def tc1000(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ msg = getEventHead()
+
+ for i in range(100):
+ seqNr = i+(ctr_responses-1)
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+ fileMap[seqNr] = seqNr
+
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+def tc1001(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ msg = getEventHead()
+
+ for i in range(100):
+ seqNr = i+(ctr_responses-1)
+ if i != 0: msg = msg + ","
+ msg = msg + getEventName("5MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+ fileMap[seqNr] = seqNr
+
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+def tc510(ftptype):
+ global ctr_responses
+ global ctr_unique_files
+
+ ctr_responses = ctr_responses + 1
+
+ if (ctr_responses > 5):
+ return buildOkResponse("[]")
+
+ msg = ""
+
+ for evts in range(700): # build events for 5 MEs
+ if (evts > 0):
+ msg = msg + ","
+ msg = msg + getEventHeadNodeName("PNF"+str(evts))
+ seqNr = (ctr_responses-1)
+ msg = msg + getEventName("1MB_" + str(seqNr) + ".tar.gz",ftptype,"onap","pano","localhost",1022)
+ seqNr = seqNr + evts*1000000 #Create unique id for this node and file
+ fileMap[seqNr] = seqNr
+ msg = msg + getEventEnd()
+
+ return buildOkResponse("["+msg+"]")
+
+#Mapping FTPS TCs
+def tc200(ftptype):
+ return tc100(ftptype)
+def tc201(ftptype):
+ return tc101(ftptype)
+def tc202(ftptype):
+ return tc102(ftptype)
+
+def tc210(ftptype):
+ return tc110(ftptype)
+def tc211(ftptype):
+ return tc111(ftptype)
+def tc212(ftptype):
+ return tc112(ftptype)
+def tc213(ftptype):
+ return tc113(ftptype)
+
+def tc220(ftptype):
+ return tc120(ftptype)
+def tc221(ftptype):
+ return tc121(ftptype)
+def tc222(ftptype):
+ return tc122(ftptype)
+
+def tc2000(ftptype):
+ return tc1000(ftptype)
+def tc2001(ftptype):
+ return tc1001(ftptype)
+
+#### Functions to build json messages and respones ####
+
+# Function to build fixed beginning of an event
+def getEventHead():
+ return getEventHeadNodeName("oteNB5309")
+
+def getEventHeadNodeName(nodename):
+ headStr = """
+ {
"event": {
"commonEventHeader": {
"startEpochMicrosec": 8745745764578,
@@ -85,205 +444,267 @@ class Reply:
},
"priority": "Normal",
"version": "4.0.1",
- "reportingEntityName": "otenb5309",
+ "reportingEntityName": \"""" + nodename + """",
"sequence": 0,
"domain": "notification",
"lastEpochMicrosec": 8745745764578,
"eventName": "Noti_RnNode-Ericsson_FileReady",
"vesEventListenerVersion": "7.0.1",
- "sourceName": "oteNB5309"
+ "sourceName": \"""" + nodename + """"
},
"notificationFields": {
"notificationFieldsVersion": "2.0",
"changeType": "FileReady",
"changeIdentifier": "PM_MEAS_FILES",
"arrayOfNamedHashMap": [
- {
- "name": \"""" +
- self.file +
- """",
+ """
+ return headStr
+
+# Function to build the variable part of an event
+def getEventName(fn,type,user,passwd,ip,port):
+ nameStr = """{
+ "name": \"""" + fn + """",
"hashMap": {
"fileFormatType": "org.3GPP.32.435#measCollec",
- "location": \"""" +
- self.type +
- """://""" +
- self.user +
- """:""" +
- self.passwd +
- """@""" +
- self.ip +
- """:""" +
- str(self.port) +
- """/""" +
- self.file +
- """",
+ "location": \"""" + type + """://""" + user + """:""" + passwd + """@""" + ip + """:""" + str(port) + """/""" + fn + """",
"fileFormatVersion": "V10",
"compression": "gzip"
}
- }
+ } """
+ return nameStr
+
+# Function to build fixed end of an event
+def getEventEnd():
+ endStr = """
]
}
}
- }]
- """)
-
-
-def replyFactory(
- ip=DEFAULT_IP,
- file="1MB.tar.gz",
- factoryport=1022,
- count=1,
- factorytype="ftps"):
- aggregatedReply = ""
- # first item does not require .
- aggregatedReply = Reply(ip, file, port=factoryport).to_json()
- for i in range(count - 1):
- aggregatedReply = aggregatedReply + b", " + \
- Reply(ip, file, port=factoryport, type=factorytype).to_json()
- #print(b"aggregated reply: " + aggregatedReply)
- return b"[" + aggregatedReply + b"]"
+ }
+ """
+ return endStr
+
+# Function to build an OK reponse from a message string
+def buildOkResponse(msg):
+ response = app.response_class(
+ response=str.encode(msg),
+ status=200,
+ mimetype='application/json')
+ return response
+
+# Function to build an empty message with status
+def buildEmptyResponse(status_code):
+ response = app.response_class(
+ response=str.encode(""),
+ status=status_code,
+ mimetype='application/json')
+ return response
-def prepareMrRespArrSftp():
- global mr_replies
-
- for i in range(400): # prepare 400 regular replies
- mr_replies.append(
- Reply(
- port=1022,
- ip="localhost",
- type="sftp",
- file="1MB.tar.gz"))
- #mr_replies[0] is not used
-
-
-def prepareMrRespArrFtps():
- global mr_replies
-
- for i in range(400):
- mr_replies.append(
- Reply(
- port=21,
- ip="localhost",
- type="ftps",
- file="1MB.tar.gz"))
-
-
-def tc1():
- prepareMrRespArrSftp()
- # no mutation needed in this TC
-
-
-def tc2():
- global mr_replies
-
- for i in range(7):
- mr_replies.append(
- Reply(
- port=1022,
- ip="localhost",
- type="sftp",
- file="1MB.tar.gz"))
-
- # inserting and empty reply message
- mr_replies[1].jsonreply = b""
- mr_replies[2].jsonreply = b""
-
- # inserting a 404 error and delay
- mr_replies[3].replytype = 2
- mr_replies[3].sleepMs = 2000
-
- # inserting and empty reply message
- mr_replies[4].jsonreply = b""
-
- # sink the message
- mr_replies[5].replytype = 1
-
- # reply with one proper file finally
- mr_replies[6] = Reply(
- port=1022,
- ip="localhost",
- type="sftp",
- file="1MB.tar.gz")
+if __name__ == "__main__":
+
+ #Counters
+ ctr_responses = 0
+ ctr_requests = 0
+ ctr_unique_files = 0
+ #Keeps all reponded file names
+ fileMap = {}
-def tc3():
- prepareMrRespArrFtps()
+ tc_num = "Not set"
+ tc_help = "Not set"
+ parser = argparse.ArgumentParser()
-def tc4():
- global mr_replies
+#SFTP TCs with single ME
+ parser.add_argument(
+ '--tc100',
+ action='store_true',
+ help='TC100 - One ME, SFTP, 1 1MB file, 1 event')
+ parser.add_argument(
+ '--tc101',
+ action='store_true',
+ help='TC101 - One ME, SFTP, 1 5MB file, 1 event')
+ parser.add_argument(
+ '--tc102',
+ action='store_true',
+ help='TC102 - One ME, SFTP, 1 50MB file, 1 event')
- for i in range(7):
- mr_replies.append(
- Reply(
- port=21,
- ip="localhost",
- type="ftps",
- file="1MB.tar.gz"))
+ parser.add_argument(
+ '--tc110',
+ action='store_true',
+ help='TC110 - One ME, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.')
+ parser.add_argument(
+ '--tc111',
+ action='store_true',
+ help='TC111 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll.')
+ parser.add_argument(
+ '--tc112',
+ action='store_true',
+ help='TC112 - One ME, SFTP, 5MB files, 100 files per event, 100 events, 1 event per poll.')
+ parser.add_argument(
+ '--tc113',
+ action='store_true',
+ help='TC113 - One ME, SFTP, 1MB files, 100 files per event, 100 events. All events in one poll.')
- # inserting and empty reply message
- mr_replies[1].jsonreply = b""
- mr_replies[2].jsonreply = b""
+ parser.add_argument(
+ '--tc120',
+ action='store_true',
+ help='TC120 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json')
+ parser.add_argument(
+ '--tc121',
+ action='store_true',
+ help='TC121 - One ME, SFTP, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files')
+ parser.add_argument(
+ '--tc122',
+ action='store_true',
+ help='TC122 - One ME, SFTP, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ')
- # inserting a 404 error and delay
- mr_replies[3].replytype = 2
- mr_replies[3].sleepMs = 2000
+ parser.add_argument(
+ '--tc1000',
+ action='store_true',
+ help='TC1000 - One ME, SFTP, 1MB files, 100 files per event, endless number of events, 1 event per poll')
+ parser.add_argument(
+ '--tc1001',
+ action='store_true',
+ help='TC1001 - One ME, SFTP, 5MB files, 100 files per event, endless number of events, 1 event per poll')
- # inserting and empty reply message
- mr_replies[4].jsonreply = b""
+# SFTP TCs with multiple MEs
+ parser.add_argument(
+ '--tc510',
+ action='store_true',
+ help='TC510 - 5 MEs, SFTP, 1MB files, 1 file per event, 100 events, 1 event per poll.')
- # sink the message
- mr_replies[5].replytype = 1
- # reply with one proper file finally
- mr_replies[6] = Reply(
- port=21,
- ip="localhost",
- type="fftp",
- file="1MB.tar.gz")
+# FTPS TCs with single ME
+ parser.add_argument(
+ '--tc200',
+ action='store_true',
+ help='TC200 - One ME, FTPS, 1 1MB file, 1 event')
+ parser.add_argument(
+ '--tc201',
+ action='store_true',
+ help='TC201 - One ME, FTPS, 1 5MB file, 1 event')
+ parser.add_argument(
+ '--tc202',
+ action='store_true',
+ help='TC202 - One ME, FTPS, 1 50MB file, 1 event')
-if __name__ == "__main__":
- mr_replies = []
- mr_counter = 0 # counting hits reaching MR instance
- DR_block_single_req = 0
+ parser.add_argument(
+ '--tc210',
+ action='store_true',
+ help='TC210 - One ME, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.')
+ parser.add_argument(
+ '--tc211',
+ action='store_true',
+ help='TC211 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll.')
+ parser.add_argument(
+ '--tc212',
+ action='store_true',
+ help='TC212 - One ME, FTPS, 5MB files, 100 files per event, 100 events, 1 event per poll.')
+ parser.add_argument(
+ '--tc213',
+ action='store_true',
+ help='TC213 - One ME, FTPS, 1MB files, 100 files per event, 100 events. All events in one poll.')
- parser = argparse.ArgumentParser()
parser.add_argument(
- '--tc1',
+ '--tc220',
+ action='store_true',
+ help='TC220 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% of replies each: no response, empty message, slow response, 404-error, malformed json')
+ parser.add_argument(
+ '--tc221',
action='store_true',
- help='TC1: reply all queries with 1-1 files using SFTP')
+ help='TC221 - One ME, FTPS, 1MB files, 100 files per event, 100 events, 1 event per poll. 10% missing files')
parser.add_argument(
- '--tc2',
+ '--tc222',
action='store_true',
- help='TC2: Reply according to error scenarios, then return 1 file finally for SFTP ---NOTE: updated keys required')
+ help='TC222 - One ME, FTPS, 1MB files, 100 files per event, 100 events. 1 event per poll. All files with identical name. ')
+
parser.add_argument(
- '--tc3',
+ '--tc2000',
action='store_true',
- help='TC3: reply all queries with 1-1 files using FTPS')
+ help='TC2000 - One ME, FTPS, 1MB files, 100 files per event, endless number of events, 1 event per poll')
parser.add_argument(
- '--tc4',
+ '--tc2001',
action='store_true',
- help='TC4: Reply according to error scenarios, then return 1 file finally for FTPS ---NOTE: updated keys required')
+ help='TC2001 - One ME, FTPS, 5MB files, 100 files per event, endless number of events, 1 event per poll')
+
+ parser.add_argument(
+ '--tc610',
+ action='store_true',
+ help='TC510 - 5 MEs, FTPS, 1MB files, 1 file per event, 100 events, 1 event per poll.')
args = parser.parse_args()
- if args.tc1:
- print("TC: #1")
- tc1()
- elif args.tc2:
- print("TC: #2")
- tc2()
- elif args.tc3:
- print("TC: #3")
- tc3()
- elif args.tc4:
- print("TC: #4")
- tc4()
+
+
+ if args.tc100:
+ tc_num = "TC# 100"
+ elif args.tc101:
+ tc_num = "TC# 101"
+ elif args.tc102:
+ tc_num = "TC# 102"
+
+ elif args.tc110:
+ tc_num = "TC# 110"
+ elif args.tc111:
+ tc_num = "TC# 111"
+ elif args.tc112:
+ tc_num = "TC# 112"
+ elif args.tc113:
+ tc_num = "TC# 113"
+
+ elif args.tc120:
+ tc_num = "TC# 120"
+ elif args.tc121:
+ tc_num = "TC# 121"
+ elif args.tc122:
+ tc_num = "TC# 122"
+
+ elif args.tc1000:
+ tc_num = "TC# 1000"
+ elif args.tc1001:
+ tc_num = "TC# 1001"
+
+ elif args.tc510:
+ tc_num = "TC# 510"
+
+ elif args.tc200:
+ tc_num = "TC# 200"
+ elif args.tc201:
+ tc_num = "TC# 201"
+ elif args.tc202:
+ tc_num = "TC# 202"
+
+ elif args.tc210:
+ tc_num = "TC# 210"
+ elif args.tc211:
+ tc_num = "TC# 211"
+ elif args.tc212:
+ tc_num = "TC# 212"
+ elif args.tc213:
+ tc_num = "TC# 213"
+
+ elif args.tc220:
+ tc_num = "TC# 220"
+ elif args.tc221:
+ tc_num = "TC# 221"
+ elif args.tc222:
+ tc_num = "TC# 222"
+
+ elif args.tc2000:
+ tc_num = "TC# 2000"
+ elif args.tc2001:
+ tc_num = "TC# 2001"
+
+ elif args.tc610:
+ tc_num = "TC# 610"
else:
print("No TC was defined")
print("use --help for usage info")
sys.exit()
- app.run(port=2222)
+
+ print(tc_num)
+
+ app.run(port=HOST_PORT, host=HOST_IP)
diff --git a/test/mocks/mass-pnf-sim/README.md b/test/mocks/mass-pnf-sim/README.md
index 1ed90b55d..ffa82c118 100644
--- a/test/mocks/mass-pnf-sim/README.md
+++ b/test/mocks/mass-pnf-sim/README.md
@@ -15,19 +15,21 @@ The ipstart should align to a /28 Ip address range start (e.g. 10.11.0.16, 10.11
For debug purposes, you can use your own IP address as VES collector, use "ip" command to determine it.
Example:
-python3 ./mass-pnf-sim.py --bootstrap 2 --ipves http://10.148.95.??:10000 --ipstart 10.11.0.16
+./mass-pnf-sim.py --bootstrap 2 --ipves http://10.148.95.??:10000 --ipfileserver 10.148.95.??? --ipstart 10.11.0.16
###Replacing VES for test purposes
-`nc -l 10000`
+`sudo nc -vv -l -k -p 10000`
###Start
Define the amount of simulators to be launched
-python3 ./mass-pnf-sim.py --start 2
+./mass-pnf-sim.py --start 2
+###Trigger
+./mass-pnf-sim.py --trigger 2
###Stop and clean
-python3 ./mass-pnf-sim.py --stop 2
-python3 ./mass-pnf-sim.py --clean
+./mass-pnf-sim.py --stop 2
+./mass-pnf-sim.py --clean
###Cleaning and recovery after incorrect configuration
docker stop $(docker ps -aq); docker rm $(docker ps -aq)
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
index ba0598671..898cd650f 100755
--- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py
+++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
@@ -14,11 +14,21 @@ parser.add_argument(
)
parser.add_argument(
+ '--trigger',
+ help='Trigger one single VES event from each simulator',
+)
+
+parser.add_argument(
'--ipves',
help='IP of the VES collector',
)
parser.add_argument(
+ '--ipfileserver',
+ help='Visible IP of the file server (SFTP/FTPS) to be included in the VES event',
+)
+
+parser.add_argument(
'--ipstart',
help='IP address range beginning',
)
@@ -49,6 +59,8 @@ args = parser.parse_args()
if args.bootstrap and args.ipstart and args.ipves:
print("Bootstrap:")
+ start_port=2000
+
for i in range(int(args.bootstrap)):
print("PNF simulator instance: " + str(i) + ".")
@@ -63,9 +75,15 @@ if args.bootstrap and args.ipstart and args.ipves:
IpPnfSim = ipaddress.ip_address(args.ipstart) + int(2 + (i * 16))
print("\tIp Pnf SIM:" + str(IpPnfSim))
+ IpFileServer = args.ipfileserver
+
+
+ PortSftp=start_port +1
+ PortFtps=start_port +2
+ start_port +=2
IpFtps = ipaddress.ip_address(args.ipstart) + int(3 + (i * 16))
print("\tIp Ftps: " + str(IpFtps))
-
+
IpSftp = ipaddress.ip_address(args.ipstart) + int(4 + (i * 16))
print("\tIp Sftp:" + str(IpSftp))
@@ -84,6 +102,9 @@ if args.bootstrap and args.ipstart and args.ipves:
str(i) + " " +\
str(args.ipves) + " " +\
str(IpPnfSim) + " " +\
+ str(IpFileServer) + " " +\
+ str(PortSftp) + " " +\
+ str(PortFtps) + " " +\
str(IpFtps) + " " +\
str(IpSftp)
@@ -139,6 +160,20 @@ if args.stop:
shell=True)
print('Stopping:', completed.stdout)
+
+if args.trigger:
+ print("Triggering VES sending:")
+
+ for i in range(int(args.trigger)):
+ foldername = "pnf-sim-lw-" + str(i)
+
+ completed = subprocess.run(
+ 'cd ' +
+ foldername +
+ "; ./simulator.sh trigger-simulator",
+ shell=True)
+ print('Status:', completed.stdout)
+
else:
print("No instruction was defined")
sys.exit()
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md
index 2b20d261e..2940b65db 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md
@@ -1,6 +1,6 @@
##Local development shortcuts:
####To start listening on port 10000 for test purposes
-`nc -l 10000`
+`nc -l -k -p 10000`
####Test the command above:
`echo "Hello World" | nc localhost 10000`
@@ -27,10 +27,12 @@ Accept-Encoding: gzip,deflate
```
```javascript
-{"commonEventHeader":{"startEpochMicrosec":"1551865758690","sourceId":"val13","eventId":"registration_51865758",
+{"event":{"commonEventHeader":{"startEpochMicrosec":"1551865758690","sourceId":"val13","eventId":"registration_51865758",
"nfcNamingCode":"oam","internalHeaderFields":{},"priority":"Normal","version":"4.0.1","reportingEntityName":"NOK6061ZW3",
-"sequence":"0","domain":"notification","lastEpochMicrosec":"1551865758690","eventName":"pnfRegistration_Nokia_5gDu","vesEventListenerVersion":"7.0.1",
-"sourceName":"NOK6061ZW3","nfNamingCode":"gNB"},"notificationFields":{"notificationFieldsVersion":"2.0","changeType":"FileReady",
-"changeIdentifier":"PM_MEAS_FILES","arrayOfNamedHashMap":{"name":"10MB.tar.gz",
-"hashMap":{"location":"10.11.0.68/10MB.tar.gz","fileFormatType":"org.3GPP.32.435#measCollec","fileFormatVersion":"V10","compression":"gzip"}}}}
+"sequence":"0","domain":"notification","lastEpochMicrosec":"1551865758690","eventName":"pnfRegistration_Nokia_5gDu",
+"vesEventListenerVersion":"7.0.1","sourceName":"NOK6061ZW3","nfNamingCode":"gNB"},
+"notificationFields":{"notificationFieldsVersion":"2.0","changeType":"FileReady","changeIdentifier":"PM_MEAS_FILES",
+"arrayOfNamedHashMap":[{"name":"10MB.tar.gz","hashMap":{
+"location":"ftpes://10.11.0.68/10MB.tar.gz","fileFormatType":"org.3GPP.32.435#measCollec",
+"fileFormatVersion":"V10","compression":"gzip"}}]}}}
``` \ No newline at end of file
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
index f53226867..aa0261c0a 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
@@ -29,6 +29,8 @@ services:
networks:
front-${I}:
ipv4_address: "${IPSFTP}"
+ ports:
+ - "${PORTSFTP}:22"
volumes:
- ./files/onap/:/home/onap/
restart: on-failure
@@ -40,6 +42,8 @@ services:
networks:
front-${I}:
ipv4_address: "${IPFTPS}"
+ ports:
+ - "${PORTFTPS}:21"
environment:
FTP_USER: onap
FTP_PASSWORD: pano
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
index bed64b0b7..86f15a8e2 100755
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
@@ -20,8 +20,8 @@ function main(){
case $COMMAND in
"compose")
- compose $2 $3 $4 $5 $6 $7 $8;;
- #IPGW, #IPSUBNET, #I, #IPVES, #IPPNFSIM, #IPFTP, #IPSFTP,
+ compose $2 $3 $4 $5 $6 $7 $8 $9 "${10}" "${11}" ;;
+ #IPGW, #IPSUBNET, #I, #IPVES, #IPPNFSIM, #IPFILESERVER, #PORTSFTP, #PORTFTPS, #IPFTPS, #IPSFTP
"build")
build_image;;
"start")
@@ -64,8 +64,11 @@ function compose(){
export I=$3
export IPVES=$4
export IPPNFSIM=$5
- export IPFTPS=$6
- export IPSFTP=$7
+ export IPFILESERVER=$6
+ export PORTSFTP=$7
+ export PORTFTPS=$8
+ export IPFTPS=$9
+ export IPSFTP=${10}
#will insert $I to distinguish containers, networks properly
#docker compose cannot substitute these, as they are keys, not values.
@@ -78,7 +81,7 @@ function compose(){
set_vsftpd_file_owner
- write_config $IPVES $IPFTPS $IPSFTP $IPPNFSIM
+ write_config $IPVES $IPFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM
}
@@ -99,9 +102,9 @@ function set_vsftpd_file_owner() {
function write_config(){
#building a YML file for usage in Java
echo "vesip: $1" > config/config.yml
- echo "ipftps: $2" >> config/config.yml
- echo "ipsftp: $3" >> config/config.yml
- echo "ippnfsim: $4" >> config/config.yml
+ echo "ipsftp: $2:$3" >> config/config.yml
+ echo "ipftps: $2:$4" >> config/config.yml
+ echo "ippnfsim: $5" >> config/config.yml
}
function start(){
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
index d59e82968..839d40269 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
@@ -114,24 +114,6 @@ public class MessageProvider {
JSONArray jsonArrayOfNamedHashMap = new JSONArray();
jsonArrayOfNamedHashMap.put(jsonHashMap);
-
-
- // // notification.put("name", "NAME_DUMMY");
- // JSONObject notification = new JSONObject();
- //
- // notificationParams.ifPresent(jsonObject -> {
- // copyParametersToFields(notification, notificationFields);
- // commonEventHeader.put(DOMAIN, DOMAIN_NOTIFICATION);
- // event.put(NOTIFICATION_FIELDS, notificationFields);
- // });
-
-
- // notificationParams.ifPresent(jsonObject -> {
- // copyParametersToFields(jsonObject.toMap(), notificationFields);
- // commonEventHeader.put(DOMAIN, DOMAIN_NOTIFICATION);
- // event.put(NOTIFICATION_FIELDS, notificationFields);
- // });
-
event.put(COMMON_EVENT_HEADER, commonEventHeader);
JSONObject root = new JSONObject();
root.put(EVENT, event);
@@ -141,7 +123,6 @@ public class MessageProvider {
public JSONObject createOneVesEvent(String xnfUrl, String fileName) {
- String notificationFields;
JSONObject nof = new JSONObject();
nof.put("notificationFieldsVersion", "2.0");
@@ -150,20 +131,20 @@ public class MessageProvider {
nof.put("changeIdentifier", "PM_MEAS_FILES");
JSONObject hm = new JSONObject();
- hm.put("location", xnfUrl.concat(fileName));
+ hm.put("location", "ftpes://".concat(xnfUrl).concat(fileName));
hm.put("fileFormatType", "org.3GPP.32.435#measCollec");
hm.put("fileFormatVersion", "V10");
hm.put("compression", "gzip");
- JSONObject aonh = new JSONObject();
- aonh.put("name", fileName);
+ JSONObject aonhElement = new JSONObject();
+ aonhElement.put("name", fileName);
+ aonhElement.put("hashMap", hm);
- aonh.put("hashMap", hm);
+ JSONArray aonh = new JSONArray();
+ aonh.put(aonhElement);
nof.put("arrayOfNamedHashMap", aonh);
- String nofString = nof.toString();
-
JSONObject ceh = new JSONObject(); // commonEventHandler
ceh.put("startEpochMicrosec", "1551865758690");
ceh.put("sourceId", "val13");
@@ -183,18 +164,23 @@ public class MessageProvider {
JSONObject ihf = new JSONObject(); // internalHeaderFields
ceh.put("internalHeaderFields", ihf);
+ JSONObject eventContent = new JSONObject();
+ eventContent.put("commonEventHeader", ceh);
+ eventContent.put("notificationFields", nof);
+
+
JSONObject event = new JSONObject();
- event.put("commonEventHeader", ceh);
- event.put("notificationFields", nof);
+ event.put("event", eventContent);
- System.out.println("event: ");
+ System.out.println("VES messages to be sent: ");
System.out.println(event.toString());
return event;
// @formatter:off
/*
- {
+ {
+ "event": {
"commonEventHeader": { <== "ceh"
"startEpochMicrosec": "1551865758690",
"sourceId": "val13",
@@ -217,21 +203,21 @@ public class MessageProvider {
"notificationFieldsVersion": "2.0",
"changeType": "FileReady",
"changeIdentifier": "PM_MEAS_FILES",
- "arrayOfNamedHashMap": { <== "aonh"
- "name": "A20161224.1030-1045.bin.gz",
- "hashMap": { <== "hm"
- "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
- "fileFormatType": "org.3GPP.32.435#measCollec",
- "fileFormatVersion": "V10",
- "compression": "gzip"
+ "arrayOfNamedHashMap": [ <== "aonh"
+ { <== "aonhElement"
+ "name": "A20161224.1030-1045.bin.gz",
+ "hashMap": { <== "hm"
+ "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
+ "fileFormatType": "org.3GPP.32.435#measCollec",
+ "fileFormatVersion": "V10",
+ "compression": "gzip"
+ }
}
- }
+ ]
}
}
-
- */
+ }
+ */
// @formatter:on
-
}
-
}
diff --git a/test/mocks/pnf-onboarding/unsecureAcmePnf.csar b/test/mocks/pnf-onboarding/unsecureAcmePnf.csar
index 92ff8fcf2..37e4733e2 100644
--- a/test/mocks/pnf-onboarding/unsecureAcmePnf.csar
+++ b/test/mocks/pnf-onboarding/unsecureAcmePnf.csar
Binary files differ