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

Update OS Image message with references to sZTP RFC #140

Merged
merged 3 commits into from
May 20, 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
17 changes: 16 additions & 1 deletion proto/bootz.proto
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,29 @@ message GetBootstrapDataResponse {
bytes serialized_bootstrap_data = 104;
}

// Fields required by the device to be able to
// download and verify an image.
// The format of this message is identical to the `boot-image` data
// model outlined in the sZTP RFC:
// https://datatracker.ietf.org/doc/html/rfc8572#section-6.1
message SoftwareImage {
// The name of the operating system software the device should be running.
string name = 1;
// The version of the operating system software the device should be running.
string version = 2;
// An HTTP location from where the OS file can be downloaded.
string url = 3;
// Hash of the OS image. The device must verify that the hash of the
// downloaded OS image matches this.
// downloaded OS image matches this. The format of this field is a
// `hex-string`, identified in RFC6991 as "A hexadecimal string with
// octets represented as hex digits separated by colons.
// The canonical representation uses lowercase characters."
gmacf marked this conversation as resolved.
Show resolved Hide resolved
// e.g.: "d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5"
string os_image_hash = 4;
// The identity of the hash algorithm used. These hash identiities are
// defined in sZTP RFC 8572. There is currenty only one hash algorithm
// defined in this spec:
// `ietf-sztp-conveyed-info:sha-256` for the SHA 256 algorithm.
string hash_algorithm = 5;
}

Expand Down
20 changes: 10 additions & 10 deletions server/entitymanager/entitymanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func TestNew(t *testing.T) {
Name: "Default Image",
Version: "1.0",
Url: "https://path/to/image",
OsImageHash: "e9c0f8b575cbfcb42ab3b78ecc87efa3b011d9a5d10b09fa4e96f240bf6a82f5",
HashAlgorithm: "SHA256",
OsImageHash: "e9:c0:f8:b5:75:cb:fc:b4:2a:b3:b7:8e:cc:87:ef:a3:b0:11:d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5",
HashAlgorithm: "ietf-sztp-conveyed-info:sha-256",
},
ControllerCards: []*epb.ControlCard{
{
Expand Down Expand Up @@ -232,9 +232,9 @@ func TestResolveChassis(t *testing.T) {
Serial: "123",
BootMode: bpb.BootMode_BOOT_MODE_INSECURE,
SoftwareImage: &bpb.SoftwareImage{
HashAlgorithm: "SHA256",
HashAlgorithm: "ietf-sztp-conveyed-info:sha-256",
Name: "Default Image",
OsImageHash: "e9c0f8b575cbfcb42ab3b78ecc87efa3b011d9a5d10b09fa4e96f240bf6a82f5",
OsImageHash: "e9:c0:f8:b5:75:cb:fc:b4:2a:b3:b7:8e:cc:87:ef:a3:b0:11:d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5",
Url: "https://path/to/image",
Version: "1.0",
},
Expand Down Expand Up @@ -441,8 +441,8 @@ func TestGetBootstrapData(t *testing.T) {
Name: "Default Image",
Version: "1.0",
Url: "https://path/to/image",
OsImageHash: "ABCDEF",
HashAlgorithm: "SHA256",
OsImageHash: "e9:c0:f8:b5:75:cb:fc:b4:2a:b3:b7:8e:cc:87:ef:a3:b0:11:d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5",
HashAlgorithm: "ietf-sztp-conveyed-info:sha-256",
},
ControllerCards: []*epb.ControlCard{
{
Expand Down Expand Up @@ -472,8 +472,8 @@ func TestGetBootstrapData(t *testing.T) {
Name: "Default Image",
Version: "1.0",
Url: "https://path/to/image",
OsImageHash: "ABCDEF",
HashAlgorithm: "SHA256",
OsImageHash: "e9:c0:f8:b5:75:cb:fc:b4:2a:b3:b7:8e:cc:87:ef:a3:b0:11:d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5",
HashAlgorithm: "ietf-sztp-conveyed-info:sha-256",
},
BootloaderPasswordHash: "ABCD123",
BootConfig: &bpb.BootConfig{
Expand All @@ -492,8 +492,8 @@ func TestGetBootstrapData(t *testing.T) {
Name: "Default Image",
Version: "1.0",
Url: "https://path/to/image",
OsImageHash: "ABCDEF",
HashAlgorithm: "SHA256",
OsImageHash: "e9:c0:f8:b5:75:cb:fc:b4:2a:b3:b7:8e:cc:87:ef:a3:b0:11:d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5",
HashAlgorithm: "ietf-sztp-conveyed-info:sha-256",
},
BootPasswordHash: "ABCD123",
ServerTrustCert: encodedServerTrustCert,
Expand Down
4 changes: 2 additions & 2 deletions testdata/inventory.prototxt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ chassis {
name: "Default Image"
version: "1.0"
url: "https://path/to/image"
os_image_hash: "e9c0f8b575cbfcb42ab3b78ecc87efa3b011d9a5d10b09fa4e96f240bf6a82f5"
hash_algorithm: "SHA256"
os_image_hash: "e9:c0:f8:b5:75:cb:fc:b4:2a:b3:b7:8e:cc:87:ef:a3:b0:11:d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5"
hash_algorithm: "ietf-sztp-conveyed-info:sha-256"
}
boot_mode: BOOT_MODE_INSECURE
config {
Expand Down
4 changes: 2 additions & 2 deletions testdata/inventory_local.prototxt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ chassis {
name: "Default Image"
version: "1.0"
url: "https://path/to/image"
os_image_hash: "e9c0f8b575cbfcb42ab3b78ecc87efa3b011d9a5d10b09fa4e96f240bf6a82f5"
hash_algorithm: "SHA256"
os_image_hash: "e9:c0:f8:b5:75:cb:fc:b4:2a:b3:b7:8e:cc:87:ef:a3:b0:11:d9:a5:d1:0b:09:fa:4e:96:f2:40:bf:6a:82:f5"
hash_algorithm: "ietf-sztp-conveyed-info:sha-256"
}
boot_mode: BOOT_MODE_INSECURE
config {
Expand Down
Loading