Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexibility refactor #9

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ build: ## compile all .proto files and generate artifacts
mkdir -p $(GENERATED_DIR)
python3 -m grpc_tools.protoc \
--proto_path=./protos \
--python_out=$(GENERATED_DIR) --pyi_out=$(GENERATED_DIR) \
et_def.proto infra.proto
--python_out=$(GENERATED_DIR) \
--pyi_out=$(GENERATED_DIR) \
--grpc_python_out=$(GENERATED_DIR) \
et_def.proto infra.proto bind.proto service.proto
python3 -m pip uninstall -y keysight-chakra
python3 setup.py bdist_wheel
python3 -m pip install --no-cache .
Expand Down
105 changes: 105 additions & 0 deletions protos/bind.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// bind.proto
//
// A data model to describe binding infrastructure paths to external
// application information.

syntax = "proto3";

package bind;

import "google/protobuf/any.proto";

// Data message allows a user to provide data outside of the scope of the
// infrastructure graph.
message Data {
// Use this field to provide descriptive information about the message
// that is packed into the value field.
string name = 1;

// The value field can be used to store external information outside the
// scope of the infra.proto messages.
//
// In addition to custom messages any wellknown type can be set into an
// Any message. See the following reference for details:
// https://protobuf.dev/reference/protobuf/google.protobuf/
//
// The following is how to serialize a proto message into the Data.value field
//
// custom_msg = CustomMessage()
// any_message = Any()
// any_message.Pack(custom_msg)
// data = Data(name="a custom message", value=custom_msg)
//
// The following is how to deserialize the contents of Data.value
//
// custom_msg = CustomMessage()
// if data.value.Is(CustomMessage.DESCRIPTOR):
// data.value.Unpack(custom_msg)
google.protobuf.Any value = 2;
}

// The Binding message offers the option of binding different types of logical
// Infrastructure endpoints to custom attributes.
//
// The format allows for attributes to be applied at a macro level such as
// all devices or at a micro level such as an individual component in a
// specific device instance.
//
// The custom attributes allows for user defined information including but not
// limited to configuration, location, identification.
// Multiple custom attributes can be applied to a single binding value
// packed into an Any type.
message Binding {
// The location of infrastructure that matches the binding type format
oneof infrastructure_path {
// the binding is global to the infrastructure and the value provided here
// is for informational purposes only
string infrastructure = 1;

// binding is specific to an Infrastructure.inventory.device.name
// example: dgx
string device = 2;

// binding is specific to an Infrastructure.inventory.device.name
// example: dgx.npu
string device_component = 3;

// binding is specific to an Infrastructure.inventory.device.name
// example: dgx.npu.0
string device_component_index = 4;

// binding is specific to an instance of
// Infrastructure.device_instances.name
// example: host
string device_instance = 5;

// binding is specific to an instance of
// Infrastructure.device_instances.name
// and an index < Infrastructure.device_instances.count
// example: host.1
string device_instance_index = 6;

// binding is specific to an instance of
// Infrastructure.device_instances.name
// and an index < Infrastructure.device_instances.count
// and an Infrastructure.inventory.device.component.name
// example: host.1.npu
string device_instance_index_component = 7;

// binding is specific to an instance of
// Infrastructure.device_instances.name
// and an index < Infrastructure.device_instances.count
// and an Infrastructure.inventory.device.component.name
// and an index < Infrastructure.inventory.device.component.name.index
// example: host.1.npu.0
string device_instance_index_component_index = 8;
}

// the data field accomodates any type of user defined information
Data data = 100;
}

message Bindings {
// A list of user defined information for specific endpoints
repeated Binding bindings = 1;
}
Loading
Loading