blob: 331740c63707d533be3d074b77f13316e4ab729e [file] [log] [blame]
Scott Baker14c8f182019-05-22 18:05:29 -07001// Portions copyright 2019-present Open Networking Foundation
2// Original copyright 2019-present Ciena Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13const {createMockServer} = require("grpc-mock");
14const options = {
15 keepCase: true,
16 enum: "String",
17 defaults: true,
18 oneofs: true,
19 includeDirs: ["/xos/v1"],
20 address: "0.0.0.0:50051"}
21const mockServer = createMockServer({
22 protoPath: "xos.proto",
23 packageName: "xos",
24 serviceName: "xos",
25 options: options,
26 rules: require('/xos/data.json')
27});
28
29// add xos.utility protos to server
30mockServer.addProtos({
31 protoPath: "utility.proto",
32 packageName: "xos",
33 serviceName: "utility",
34 options: options});
35
36// add xos.dynamicload protos to server
37mockServer.addProtos({
38 protoPath: "dynamicload.proto",
39 packageName: "xos",
40 serviceName: "dynamicload",
41 options: options});
42
43// add xos.filetransfer protos to server
44mockServer.addProtos({
45 protoPath: "filetransfer.proto",
46 packageName: "xos",
47 serviceName: "filetransfer",
48 options: options});
49
50process.on('SIGINT', function() {
51 console.log("Caught interrupt signal");
52 process.exit();
53});
54mockServer.listen("0.0.0.0:50051");
55console.log("Listening for requests\n")