XOS exposes a gRPC API, here is the guide to generate .proto
files starting from xproto
files.
The XOS data model is defined through xProto
(you can read more on it here) and services load their models at runtime, so the corresponding gRPC API is subject to changes.
There is a set of gRPC API that is stable and defined in xos/coreapi/protos/utility.proto
The way we address this is to generate the proto files at runtime when a client connects. You can find an example of this in the xos-tosca
container, but here a short description of the workflow:
.proto
files using the xosgenx toolchain with the protoapi .xtargetNOTE: if your are developing against a fixed version you don't need to do this
The models that XOS uses are spread in few places:
xos
repo: xos/core/models/core.xprotoxos/synchronizer/models/<service-name>.xproto
Once you have located the models you need and you have the virtualenv installed, you can use this command to generate the .proto
files:
xosgenx --target=protoapi.xtarget --write-to-file=single --output=. --dest-file=xos.proto hippie-oss/xos/synchronizer/models/hippie-oss.xproto olt-service/xos/synchronizer/models/volt.xproto
NOTE: in the above command we are passing two files to the
xproto
toolchain:hippie-oss/xos/synchronizer/models/hippie-oss.xproto
andolt-service/xos/synchronizer/models/volt.xproto
we are also storing the output in a file calledxos.proto
in the current workdir
After generating the .proto
files you need to grab:
before generating code using the gRPC toolchain