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

feat: add virtualization object types support #155

Merged
merged 22 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ gen-diode-go-internal:
gen-diode-sdk-python:
@cd diode-proto/ && buf format -w && buf generate --template buf.gen.py.yaml --include-imports
@find ../diode-sdk-python/netboxlabs/diode/sdk \( -name '*.py' -o -name '*.pyi' \) \
-exec sed -i '' 's/^from diode.v1/from netboxlabs.diode.sdk.diode.v1/; s/^from validate/from netboxlabs.diode.sdk.validate/' {} \;
-exec sed -i.bak -e 's/^from diode.v1/from netboxlabs.diode.sdk.diode.v1/' \
-e 's/^from validate/from netboxlabs.diode.sdk.validate/' {} \; -exec rm -f {}.bak \;
116 changes: 116 additions & 0 deletions diode-proto/diode/v1/ingester.proto
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,116 @@ message Interface {
repeated Tag tags = 14;
}

//A Cluster
message Cluster {
string name = 1 [(validate.rules).string = {
min_len: 1
max_len: 100
}];
ClusterType type = 2;
ClusterGroup group = 3;
Site site = 4;
string status = 5 [(validate.rules).string = {
in: [
"offline",
"active",
"planned",
"staged",
"failed",
"decommissioning"
]
}];
optional string description = 6 [(validate.rules).string = {max_len: 200}];
repeated Tag tags = 7;
}

//A Cluster Type
message ClusterType {
string name = 1 [(validate.rules).string = {
min_len: 1
max_len: 100
}];
string slug = 2 [(validate.rules).string = {
min_len: 1
max_len: 100
pattern: "^[-a-zA-Z0-9_]+$"
}];
optional string description = 3 [(validate.rules).string = {max_len: 200}];
repeated Tag tags = 4;
}

//A Cluster Group
message ClusterGroup {
string name = 1 [(validate.rules).string = {
min_len: 1
max_len: 100
}];
string slug = 2 [(validate.rules).string = {
min_len: 1
max_len: 100
pattern: "^[-a-zA-Z0-9_]+$"
}];
optional string description = 3 [(validate.rules).string = {max_len: 200}];
repeated Tag tags = 4;
}

//A Virtual Machine
message VirtualMachine {
string name = 1 [(validate.rules).string = {max_len: 64}];
string status = 2 [(validate.rules).string = {
in: [
"offline",
"active",
"planned",
"staged",
"failed",
"decommissioning"
]
}];
Site site = 3;
Cluster cluster = 4;
Role role = 5;
Device device = 6;
Platform platform = 7;
IPAddress primary_ip4 = 8;
IPAddress primary_ip6 = 9;
optional int32 vcpus = 10 [(validate.rules).int32 = {gte: 0}];
optional int32 memory = 11 [(validate.rules).int32 = {gte: 0}];
optional int32 disk = 12 [(validate.rules).int32 = {gte: 0}];
optional string description = 13 [(validate.rules).string = {max_len: 200}];
optional string comments = 14;
repeated Tag tags = 15;
}

//A Virtual Machine Interface
message VMInterface {
VirtualMachine virtual_machine = 1 [(validate.rules).any.required = true];
string name = 2 [(validate.rules).string = {
min_len: 1
max_len: 64
}];
optional bool enabled = 3;
optional int32 mtu = 4 [(validate.rules).int32 = {
gte: 1
lte: 65536
}];
optional string mac_address = 5;
optional string description = 6 [(validate.rules).string = {max_len: 200}];
repeated Tag tags = 7;
}

//A Virtual Disk
message VirtualDisk {
VirtualMachine virtual_machine = 1 [(validate.rules).any.required = true];
string name = 2 [(validate.rules).string = {
min_len: 1
max_len: 100
}];
int32 size = 3 [(validate.rules).int32 = {gte: 0}];
optional string description = 4 [(validate.rules).string = {max_len: 200}];
repeated Tag tags = 5;
}

// An IP address.
message IPAddress {
string address = 1 [(validate.rules).string.ip = true];
Expand Down Expand Up @@ -370,6 +480,12 @@ message Entity {
Interface interface = 7;
IPAddress ip_address = 9;
Prefix prefix = 10;
ClusterGroup cluster_group = 11;
ClusterType cluster_type = 12;
Cluster cluster = 13;
VirtualMachine virtual_machine = 14;
VMInterface vminterface = 15;
VirtualDisk virtual_disk = 16;
}

// The timestamp of the data discovery at source
Expand Down
Loading
Loading