diff --git a/proto/bootz.proto b/proto/bootz.proto index 2f49c4e..fe836e8 100644 --- a/proto/bootz.proto +++ b/proto/bootz.proto @@ -227,23 +227,6 @@ message ReportStatusRequest { message EmptyResponse { } -// Chassis represents a single chassis owned by an organization. -message Chassis { - string serial_number = 1; - string manufacturer = 2; - string part_number = 3; - repeated ControlCard control_cards = 4; - string hostname = 5; - BootMode boot_mode = 6; - SoftwareImage software_image = 7; - string management_ip = 8; - BootConfig boot_config = 9; - Credentials credentials = 10; - gnsi.pathz.v1.UploadRequest pathz = 11; - gnsi.authz.v1.UploadRequest authz = 12; - gnsi.certz.v1.UploadRequest certificates = 13; -} - // BootMode specifies if the chassis should utilize OV data. // Secure mode uses the OV validation. enum BootMode { diff --git a/proto/bootz/bootz.pb.go b/proto/bootz/bootz.pb.go index 4ead96f..07392dd 100755 --- a/proto/bootz/bootz.pb.go +++ b/proto/bootz/bootz.pb.go @@ -992,149 +992,6 @@ func (*EmptyResponse) Descriptor() ([]byte, []int) { return file_proto_bootz_proto_rawDescGZIP(), []int{11} } -type Chassis struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SerialNumber string `protobuf:"bytes,1,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"` - Manufacturer string `protobuf:"bytes,2,opt,name=manufacturer,proto3" json:"manufacturer,omitempty"` - PartNumber string `protobuf:"bytes,3,opt,name=part_number,json=partNumber,proto3" json:"part_number,omitempty"` - ControlCards []*ControlCard `protobuf:"bytes,4,rep,name=control_cards,json=controlCards,proto3" json:"control_cards,omitempty"` - Hostname string `protobuf:"bytes,5,opt,name=hostname,proto3" json:"hostname,omitempty"` - BootMode BootMode `protobuf:"varint,6,opt,name=boot_mode,json=bootMode,proto3,enum=bootz.proto.BootMode" json:"boot_mode,omitempty"` - SoftwareImage *SoftwareImage `protobuf:"bytes,7,opt,name=software_image,json=softwareImage,proto3" json:"software_image,omitempty"` - ManagementIp string `protobuf:"bytes,8,opt,name=management_ip,json=managementIp,proto3" json:"management_ip,omitempty"` - BootConfig *BootConfig `protobuf:"bytes,9,opt,name=boot_config,json=bootConfig,proto3" json:"boot_config,omitempty"` - Credentials *Credentials `protobuf:"bytes,10,opt,name=credentials,proto3" json:"credentials,omitempty"` - Pathz *pathz.UploadRequest `protobuf:"bytes,11,opt,name=pathz,proto3" json:"pathz,omitempty"` - Authz *authz.UploadRequest `protobuf:"bytes,12,opt,name=authz,proto3" json:"authz,omitempty"` - Certificates *certz.UploadRequest `protobuf:"bytes,13,opt,name=certificates,proto3" json:"certificates,omitempty"` -} - -func (x *Chassis) Reset() { - *x = Chassis{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_bootz_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Chassis) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Chassis) ProtoMessage() {} - -func (x *Chassis) ProtoReflect() protoreflect.Message { - mi := &file_proto_bootz_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Chassis.ProtoReflect.Descriptor instead. -func (*Chassis) Descriptor() ([]byte, []int) { - return file_proto_bootz_proto_rawDescGZIP(), []int{12} -} - -func (x *Chassis) GetSerialNumber() string { - if x != nil { - return x.SerialNumber - } - return "" -} - -func (x *Chassis) GetManufacturer() string { - if x != nil { - return x.Manufacturer - } - return "" -} - -func (x *Chassis) GetPartNumber() string { - if x != nil { - return x.PartNumber - } - return "" -} - -func (x *Chassis) GetControlCards() []*ControlCard { - if x != nil { - return x.ControlCards - } - return nil -} - -func (x *Chassis) GetHostname() string { - if x != nil { - return x.Hostname - } - return "" -} - -func (x *Chassis) GetBootMode() BootMode { - if x != nil { - return x.BootMode - } - return BootMode_BOOT_MODE_UNSPECIFIED -} - -func (x *Chassis) GetSoftwareImage() *SoftwareImage { - if x != nil { - return x.SoftwareImage - } - return nil -} - -func (x *Chassis) GetManagementIp() string { - if x != nil { - return x.ManagementIp - } - return "" -} - -func (x *Chassis) GetBootConfig() *BootConfig { - if x != nil { - return x.BootConfig - } - return nil -} - -func (x *Chassis) GetCredentials() *Credentials { - if x != nil { - return x.Credentials - } - return nil -} - -func (x *Chassis) GetPathz() *pathz.UploadRequest { - if x != nil { - return x.Pathz - } - return nil -} - -func (x *Chassis) GetAuthz() *authz.UploadRequest { - if x != nil { - return x.Authz - } - return nil -} - -func (x *Chassis) GetCertificates() *certz.UploadRequest { - if x != nil { - return x.Certificates - } - return nil -} - var File_proto_bootz_proto protoreflect.FileDescriptor var file_proto_bootz_proto_rawDesc = []byte{ @@ -1319,68 +1176,27 @@ var file_proto_bootz_proto_rawDesc = []byte{ 0x45, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x42, 0x4f, 0x4f, 0x54, 0x53, 0x54, 0x52, 0x41, 0x50, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x0f, 0x0a, 0x0d, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8a, 0x05, 0x0a, 0x07, 0x43, 0x68, 0x61, 0x73, 0x73, 0x69, 0x73, - 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, - 0x74, 0x75, 0x72, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x6e, - 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x72, - 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x70, 0x61, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0d, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x63, 0x61, 0x72, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x43, 0x61, 0x72, 0x64, 0x52, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x43, 0x61, 0x72, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, - 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, - 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x62, 0x6f, 0x6f, 0x74, 0x5f, 0x6d, 0x6f, - 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x52, - 0x08, 0x62, 0x6f, 0x6f, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x73, 0x6f, 0x66, - 0x74, 0x77, 0x61, 0x72, 0x65, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x0d, 0x73, - 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, - 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x62, 0x6f, 0x6f, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6f, 0x6f, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, - 0x0a, 0x62, 0x6f, 0x6f, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3a, 0x0a, 0x0b, 0x63, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x7a, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6e, 0x73, 0x69, 0x2e, 0x70, 0x61, - 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x7a, 0x12, 0x32, 0x0a, 0x05, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6e, 0x73, - 0x69, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x12, - 0x40, 0x0a, 0x0c, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, - 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6e, 0x73, 0x69, 0x2e, 0x63, 0x65, 0x72, - 0x74, 0x7a, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x52, 0x0c, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x73, 0x2a, 0x53, 0x0a, 0x08, 0x42, 0x6f, 0x6f, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, - 0x15, 0x42, 0x4f, 0x4f, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x42, 0x4f, 0x4f, 0x54, - 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x43, 0x55, 0x52, 0x45, 0x10, 0x01, - 0x12, 0x14, 0x0a, 0x10, 0x42, 0x4f, 0x4f, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x45, - 0x43, 0x55, 0x52, 0x45, 0x10, 0x02, 0x32, 0xbe, 0x01, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, - 0x74, 0x72, 0x61, 0x70, 0x12, 0x61, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x74, 0x73, - 0x74, 0x72, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x24, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, - 0x72, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, - 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, - 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x6f, 0x6f, 0x74, - 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x62, 0x6f, 0x6f, - 0x74, 0x7a, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0x53, 0x0a, 0x08, 0x42, 0x6f, 0x6f, 0x74, 0x4d, 0x6f, 0x64, 0x65, + 0x12, 0x19, 0x0a, 0x15, 0x42, 0x4f, 0x4f, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x42, + 0x4f, 0x4f, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x4e, 0x53, 0x45, 0x43, 0x55, 0x52, + 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x4f, 0x4f, 0x54, 0x5f, 0x4d, 0x4f, 0x44, 0x45, + 0x5f, 0x53, 0x45, 0x43, 0x55, 0x52, 0x45, 0x10, 0x02, 0x32, 0xbe, 0x01, 0x0a, 0x09, 0x42, 0x6f, + 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x61, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x42, 0x6f, + 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x24, 0x2e, 0x62, 0x6f, + 0x6f, 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, + 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x25, 0x2e, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x0c, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x6f, 0x6f, + 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, + 0x6f, 0x6f, 0x74, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x62, 0x6f, 0x6f, 0x74, 0x7a, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1396,7 +1212,7 @@ func file_proto_bootz_proto_rawDescGZIP() []byte { } var file_proto_bootz_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_proto_bootz_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_proto_bootz_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_proto_bootz_proto_goTypes = []interface{}{ (BootMode)(0), // 0: bootz.proto.BootMode (ControlCardState_ControlCardStatus)(0), // 1: bootz.proto.ControlCardState.ControlCardStatus @@ -1413,14 +1229,13 @@ var file_proto_bootz_proto_goTypes = []interface{}{ (*BootConfig)(nil), // 12: bootz.proto.BootConfig (*ReportStatusRequest)(nil), // 13: bootz.proto.ReportStatusRequest (*EmptyResponse)(nil), // 14: bootz.proto.EmptyResponse - (*Chassis)(nil), // 15: bootz.proto.Chassis - (*pathz.UploadRequest)(nil), // 16: gnsi.pathz.v1.UploadRequest - (*authz.UploadRequest)(nil), // 17: gnsi.authz.v1.UploadRequest - (*certz.UploadRequest)(nil), // 18: gnsi.certz.v1.UploadRequest - (*credentialz.AuthorizedKeysRequest)(nil), // 19: gnsi.credentialz.v1.AuthorizedKeysRequest - (*credentialz.AuthorizedUsersRequest)(nil), // 20: gnsi.credentialz.v1.AuthorizedUsersRequest - (*credentialz.PasswordRequest)(nil), // 21: gnsi.credentialz.v1.PasswordRequest - (*structpb.Struct)(nil), // 22: google.protobuf.Struct + (*pathz.UploadRequest)(nil), // 15: gnsi.pathz.v1.UploadRequest + (*authz.UploadRequest)(nil), // 16: gnsi.authz.v1.UploadRequest + (*certz.UploadRequest)(nil), // 17: gnsi.certz.v1.UploadRequest + (*credentialz.AuthorizedKeysRequest)(nil), // 18: gnsi.credentialz.v1.AuthorizedKeysRequest + (*credentialz.AuthorizedUsersRequest)(nil), // 19: gnsi.credentialz.v1.AuthorizedUsersRequest + (*credentialz.PasswordRequest)(nil), // 20: gnsi.credentialz.v1.PasswordRequest + (*structpb.Struct)(nil), // 21: google.protobuf.Struct } var file_proto_bootz_proto_depIdxs = []int32{ 4, // 0: bootz.proto.GetBootstrapDataRequest.chassis_descriptor:type_name -> bootz.proto.ChassisDescriptor @@ -1430,35 +1245,27 @@ var file_proto_bootz_proto_depIdxs = []int32{ 10, // 4: bootz.proto.BootstrapDataResponse.intended_image:type_name -> bootz.proto.SoftwareImage 12, // 5: bootz.proto.BootstrapDataResponse.boot_config:type_name -> bootz.proto.BootConfig 11, // 6: bootz.proto.BootstrapDataResponse.credentials:type_name -> bootz.proto.Credentials - 16, // 7: bootz.proto.BootstrapDataResponse.pathz:type_name -> gnsi.pathz.v1.UploadRequest - 17, // 8: bootz.proto.BootstrapDataResponse.authz:type_name -> gnsi.authz.v1.UploadRequest - 18, // 9: bootz.proto.BootstrapDataResponse.certificates:type_name -> gnsi.certz.v1.UploadRequest + 15, // 7: bootz.proto.BootstrapDataResponse.pathz:type_name -> gnsi.pathz.v1.UploadRequest + 16, // 8: bootz.proto.BootstrapDataResponse.authz:type_name -> gnsi.authz.v1.UploadRequest + 17, // 9: bootz.proto.BootstrapDataResponse.certificates:type_name -> gnsi.certz.v1.UploadRequest 7, // 10: bootz.proto.BootstrapDataSigned.responses:type_name -> bootz.proto.BootstrapDataResponse 8, // 11: bootz.proto.GetBootstrapDataResponse.signed_response:type_name -> bootz.proto.BootstrapDataSigned - 19, // 12: bootz.proto.Credentials.credentials:type_name -> gnsi.credentialz.v1.AuthorizedKeysRequest - 20, // 13: bootz.proto.Credentials.users:type_name -> gnsi.credentialz.v1.AuthorizedUsersRequest - 21, // 14: bootz.proto.Credentials.passwords:type_name -> gnsi.credentialz.v1.PasswordRequest - 22, // 15: bootz.proto.BootConfig.metadata:type_name -> google.protobuf.Struct - 22, // 16: bootz.proto.BootConfig.bootloader_config:type_name -> google.protobuf.Struct + 18, // 12: bootz.proto.Credentials.credentials:type_name -> gnsi.credentialz.v1.AuthorizedKeysRequest + 19, // 13: bootz.proto.Credentials.users:type_name -> gnsi.credentialz.v1.AuthorizedUsersRequest + 20, // 14: bootz.proto.Credentials.passwords:type_name -> gnsi.credentialz.v1.PasswordRequest + 21, // 15: bootz.proto.BootConfig.metadata:type_name -> google.protobuf.Struct + 21, // 16: bootz.proto.BootConfig.bootloader_config:type_name -> google.protobuf.Struct 2, // 17: bootz.proto.ReportStatusRequest.status:type_name -> bootz.proto.ReportStatusRequest.BootstrapStatus 6, // 18: bootz.proto.ReportStatusRequest.states:type_name -> bootz.proto.ControlCardState - 5, // 19: bootz.proto.Chassis.control_cards:type_name -> bootz.proto.ControlCard - 0, // 20: bootz.proto.Chassis.boot_mode:type_name -> bootz.proto.BootMode - 10, // 21: bootz.proto.Chassis.software_image:type_name -> bootz.proto.SoftwareImage - 12, // 22: bootz.proto.Chassis.boot_config:type_name -> bootz.proto.BootConfig - 11, // 23: bootz.proto.Chassis.credentials:type_name -> bootz.proto.Credentials - 16, // 24: bootz.proto.Chassis.pathz:type_name -> gnsi.pathz.v1.UploadRequest - 17, // 25: bootz.proto.Chassis.authz:type_name -> gnsi.authz.v1.UploadRequest - 18, // 26: bootz.proto.Chassis.certificates:type_name -> gnsi.certz.v1.UploadRequest - 3, // 27: bootz.proto.Bootstrap.GetBootstrapData:input_type -> bootz.proto.GetBootstrapDataRequest - 13, // 28: bootz.proto.Bootstrap.ReportStatus:input_type -> bootz.proto.ReportStatusRequest - 9, // 29: bootz.proto.Bootstrap.GetBootstrapData:output_type -> bootz.proto.GetBootstrapDataResponse - 14, // 30: bootz.proto.Bootstrap.ReportStatus:output_type -> bootz.proto.EmptyResponse - 29, // [29:31] is the sub-list for method output_type - 27, // [27:29] is the sub-list for method input_type - 27, // [27:27] is the sub-list for extension type_name - 27, // [27:27] is the sub-list for extension extendee - 0, // [0:27] is the sub-list for field type_name + 3, // 19: bootz.proto.Bootstrap.GetBootstrapData:input_type -> bootz.proto.GetBootstrapDataRequest + 13, // 20: bootz.proto.Bootstrap.ReportStatus:input_type -> bootz.proto.ReportStatusRequest + 9, // 21: bootz.proto.Bootstrap.GetBootstrapData:output_type -> bootz.proto.GetBootstrapDataResponse + 14, // 22: bootz.proto.Bootstrap.ReportStatus:output_type -> bootz.proto.EmptyResponse + 21, // [21:23] is the sub-list for method output_type + 19, // [19:21] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_proto_bootz_proto_init() } @@ -1611,18 +1418,6 @@ func file_proto_bootz_proto_init() { return nil } } - file_proto_bootz_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Chassis); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1630,7 +1425,7 @@ func file_proto_bootz_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_bootz_proto_rawDesc, NumEnums: 3, - NumMessages: 13, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/server/entitymanager/entitymanager.go b/server/entitymanager/entitymanager.go index 2188e1a..1d31ae7 100644 --- a/server/entitymanager/entitymanager.go +++ b/server/entitymanager/entitymanager.go @@ -38,6 +38,8 @@ import ( apb "github.com/openconfig/gnsi/authz" ) +const defaultRealm = "prod" + // InMemoryEntityManager provides a simple in memory handler // for Entities. type InMemoryEntityManager struct { @@ -55,12 +57,29 @@ type InMemoryEntityManager struct { // ResolveChassis returns an entity based on the provided lookup. // If a control card serial is provided, it also looks up chassis' by its control cards. -func (m *InMemoryEntityManager) ResolveChassis(ctx context.Context, lookup *service.EntityLookup, ccSerial string) (*bpb.Chassis, error) { +func (m *InMemoryEntityManager) ResolveChassis(ctx context.Context, lookup *service.EntityLookup, ccSerial string) (*service.Chassis, error) { chassis, err := m.lookupChassis(lookup, ccSerial) if err != nil { return nil, err } - return &bpb.Chassis{BootMode: chassis.BootMode}, nil + cards := make([]*service.ControlCard, len(chassis.GetControllerCards())) + for i, controlCard := range chassis.GetControllerCards() { + cards[i] = &service.ControlCard{ + PartNumber: controlCard.PartNumber, + Manufacturer: chassis.GetManufacturer(), + Serial: controlCard.GetSerialNumber(), + } + } + return &service.Chassis{ + Hostname: chassis.GetName(), + BootMode: chassis.GetBootMode(), + SoftwareImage: chassis.GetSoftwareImage(), + Realm: defaultRealm, + Manufacturer: chassis.GetManufacturer(), + PartNumber: chassis.GetPartNumber(), + Serial: chassis.GetSerialNumber(), + ControlCards: cards, + }, nil } func (m *InMemoryEntityManager) lookupChassis(lookup *service.EntityLookup, ccSerial string) (*epb.Chassis, error) { @@ -155,7 +174,7 @@ func populateBootConfig(conf *epb.BootConfig) (*bpb.BootConfig, error) { } // GetBootstrapData fetches and returns the bootstrap data response from the server. -func (m *InMemoryEntityManager) GetBootstrapData(ctx context.Context, ch *bpb.Chassis, lookup *service.EntityLookup, controllerCard *bpb.ControlCard) (*bpb.BootstrapDataResponse, error) { +func (m *InMemoryEntityManager) GetBootstrapData(ctx context.Context, ch *service.Chassis, lookup *service.EntityLookup, controllerCard *bpb.ControlCard) (*bpb.BootstrapDataResponse, error) { serial := lookup.SerialNumber if controllerCard != nil { serial = controllerCard.GetSerialNumber() diff --git a/server/entitymanager/entitymanager_test.go b/server/entitymanager/entitymanager_test.go index 9265ad3..8168f4d 100644 --- a/server/entitymanager/entitymanager_test.go +++ b/server/entitymanager/entitymanager_test.go @@ -217,7 +217,7 @@ func TestResolveChassis(t *testing.T) { tests := []struct { desc string input *service.EntityLookup - want *bpb.Chassis + want *service.Chassis wantErr bool }{{ desc: "Default device", @@ -225,8 +225,12 @@ func TestResolveChassis(t *testing.T) { SerialNumber: "123", Manufacturer: "Cisco", }, - want: &bpb.Chassis{ - BootMode: bpb.BootMode_BOOT_MODE_SECURE, + want: &service.Chassis{ + Manufacturer: "Cisco", + Realm: "prod", + Serial: "123", + BootMode: bpb.BootMode_BOOT_MODE_SECURE, + ControlCards: []*service.ControlCard{}, }, }, { desc: "Chassis Not Found", @@ -247,8 +251,8 @@ func TestResolveChassis(t *testing.T) { if (err != nil) != test.wantErr { t.Fatalf("ResolveChassis(%v) err = %v, want %v", test.input, err, test.wantErr) } - if !cmp.Equal(got, test.want, protocmp.Transform()) { - t.Errorf("ResolveChassis(%v) got %v, want %v", test.input, got, test.want) + if diff := cmp.Diff(got, test.want, protocmp.Transform()); diff != "" { + t.Errorf("ResolveChassis(%v) diff = %v", test.input, diff) } }) } @@ -546,7 +550,7 @@ func TestGetBootstrapData(t *testing.T) { for _, test := range tests { t.Run(test.desc, func(t *testing.T) { // TODO(https://github.com/openconfig/bootz/issues/105): Populate bpb.Chassis once epb.Chassis has been de-duplicated. - got, err := em.GetBootstrapData(ctx, &bpb.Chassis{}, &service.EntityLookup{SerialNumber: test.chassisSerial, Manufacturer: test.chassisManufacturer}, test.input) + got, err := em.GetBootstrapData(ctx, &service.Chassis{}, &service.EntityLookup{SerialNumber: test.chassisSerial, Manufacturer: test.chassisManufacturer}, test.input) if (err != nil) != test.wantErr { t.Errorf("GetBootstrapData(%v) err = %v, want %v", test.input, err, test.wantErr) } diff --git a/server/service/service.go b/server/service/service.go index 8416b40..bb7c441 100644 --- a/server/service/service.go +++ b/server/service/service.go @@ -74,6 +74,33 @@ type EntityLookup struct { Modular bool } +// Describes a Chassis that has been resolved from an organization's inventory. +type Chassis struct { + // The intended hostname of the chassis. + Hostname string + // The mode this chassis should boot into. + BootMode bpb.BootMode + // The intended software image to install on the device. + SoftwareImage *bpb.SoftwareImage + // The realm this chassis exists in, typically lab or prod. + Realm string + // The manufacturer of this chassis. + Manufacturer string + // The part number of this chassis. + PartNumber string + // The serial number of this chassis. + Serial string + // Describes the control cards that exist in this chassis. + ControlCards []*ControlCard +} + +// Describes a control card that exists in a resolved Chassis. +type ControlCard struct { + Manufacturer string + PartNumber string + Serial string +} + // buildEntityLookup constructs an EntityLookup object from a bootstrap request. func buildEntityLookup(ctx context.Context, req *bpb.GetBootstrapDataRequest) (*EntityLookup, error) { peerAddr, err := peerAddressFromContext(ctx) @@ -113,8 +140,8 @@ func buildEntityLookup(ctx context.Context, req *bpb.GetBootstrapDataRequest) (* // EntityManager maintains the entities and their states. type EntityManager interface { - ResolveChassis(context.Context, *EntityLookup, string) (*bpb.Chassis, error) - GetBootstrapData(context.Context, *bpb.Chassis, *EntityLookup, *bpb.ControlCard) (*bpb.BootstrapDataResponse, error) + ResolveChassis(context.Context, *EntityLookup, string) (*Chassis, error) + GetBootstrapData(context.Context, *Chassis, *EntityLookup, *bpb.ControlCard) (*bpb.BootstrapDataResponse, error) SetStatus(context.Context, *bpb.ReportStatusRequest) error Sign(context.Context, *bpb.GetBootstrapDataResponse, *EntityLookup, string) error }