SEBA-688 add additional unit tests
Change-Id: I361bc872af08b97bccb29f17838940205fed48e9
diff --git a/mock/README.md b/mock/README.md
index a70b6fc..faf8b01 100644
--- a/mock/README.md
+++ b/mock/README.md
@@ -1,3 +1,9 @@
This directory contains a mock server that is used when unit-testing the cordctl client. This mock server is implemented in javascript and runs using nodejs inside of a docker container.
Because the nodejs gRPC server implementation does not yet support the gRPC reflection API, a set of statically built protobufs, `xos-core.protoset`, is made available and can be used with the client instead of the reflection API. This protoset is not intended to be an operational substitute for the API retrieved via reflection, but is merely a convenience for unit testing.
+
+To regenerate the protoset from inside a running xos-core container, do this:
+
+```bash
+python -m grpc.tools.protoc --proto_path=. --descriptor_set_out=xos-core.protoset --include_imports xos.proto utility.proto filetransfer.proto dynamicload.proto modeldefs.proto
+```
diff --git a/mock/data.json b/mock/data.json
index 710f423..fd1bb03 100644
--- a/mock/data.json
+++ b/mock/data.json
@@ -119,6 +119,95 @@
"method": "DeleteSlice",
"input": {"id": 77},
"error": { "code": 2, "message": "Slice matching query does not exist."}
+ },
+ {
+ "method": "GetLoadStatus",
+ "input": ".*",
+ "output": {"services": [
+ {"name": "onos",
+ "version": "2.1.1-dev",
+ "state": "present"},
+ {"name": "kubernetes",
+ "version": "1.2.1",
+ "state": "present"}]}
+ },
+ {
+ "method": "Download",
+ "input": ".*",
+ "streamType": "server",
+ "stream": [
+ {"output": { "chunk": "ABC"} },
+ {"output": { "chunk": "DEF"} }
+ ]
+ },
+ {
+ "method": "Upload",
+ "input": ".*",
+ "streamType": "client",
+ "stream": [
+ {"input": { "chunk": "ABC", "uri": "file:///tmp/transfer.up"} },
+ {"input": { "chunk": "DEF", "uri": "file:///tmp/transfer.up"} }
+ ],
+ "output": { "status": 0,
+ "checksum": "sha256:e9c0f8b575cbfcb42ab3b78ecc87efa3b011d9a5d10b09fa4e96f240bf6a82f5",
+ "chunks_received": 2,
+ "bytes_received": 6 }
+ },
+ {
+ "method": "CreateBackupOperation",
+ "input": {"operation": "create"},
+ "output": {
+ "id": 1,
+ "uuid": "uuid1"
+ }
+ },
+ {
+ "method": "GetBackupOperation",
+ "input": {"id": 1},
+ "output": {
+ "id": 1,
+ "operation": "create",
+ "status": "created",
+ "updated": 1234.0,
+ "enacted": 1234.0,
+ "file_id": 33
+ }
+ },
+ {
+ "method": "GetBackupFile",
+ "input": {"id": 33},
+ "output": {
+ "id": 33,
+ "uri": "file:///transfer.down",
+ "checksum": "sha256:e9c0f8b575cbfcb42ab3b78ecc87efa3b011d9a5d10b09fa4e96f240bf6a82f5"
+ }
+ },
+ {
+ "method": "CreateBackupFile",
+ "input": ".*",
+ "output": {
+ "id": 34,
+ "uuid": "uuid34"
+ }
+ },
+ {
+ "method": "CreateBackupOperation",
+ "input": {"operation": "restore"},
+ "output": {
+ "id": 3,
+ "uuid": "uuid3"
+ }
+ },
+ {
+ "method": "FilterBackupOperation",
+ "input": {"elements": [{"operator": 0, "name": "uuid", "sValue": "uuid3"}]},
+ "output": {"items": [{
+ "id": 3,
+ "operation": "restore",
+ "status": "restored",
+ "updated": 1234.0,
+ "enacted": 1234.0,
+ "file_id": 34
+ }]}
}
-
]
diff --git a/mock/xos-core.protoset b/mock/xos-core.protoset
index e1d069f..1515ded 100644
--- a/mock/xos-core.protoset
+++ b/mock/xos-core.protoset
Binary files differ