-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add config to skip DHCP boot to gnoi.FactoryReset. #204
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Does this really belong in IMO a separate service would be more appropriate, something like |
@mhines01: as SME on Bootz @robshakir please review. |
That would mean we would have two separate services for factory reset and engaging bootz? One with and one without DHCP boot. |
I'd say that would be a separate service to provision this "pseudo-dhcp" configuration of bootz to the device (that will be active during the next bootz cycle). Bootz trigger doesn't have to change (you can still call the FactoryReset to initiate the process). In general, bootz and factoryReset are independent from each other. In your specific use case, factoryReset is typically a trigger to initiate bootz (if the device was shipped from a factory in bootz-enabled mode or was enabled to use bootz by any other means), but that's only a specific use case. |
Fundamentally this is about skipping DHCP Boot not Bootz in particular. The SZTP RFC (And by extension the Bootz spec) specifies a "bootstrap-server-list" in the boot option. I chose bootstrap_server_uris because it is more descriptive as to what is actually supposed to go in the variable.
I see a couple of options here:
I think it's important to recognize that fundamentally this is about skipping DHCP boot after factory reset. We are doing this to support Bootz testing today, but it's not specific to bootz (Any more than DHCP is specific to SZTP or Bootz) and in the future we may want to use this for other testing or other purposes beyond Bootz. With that in mind:
For now I am keeping it as is and just changed bootz_uris to boot_server_uris to make it generic. |
@@ -47,6 +62,8 @@ message ResetError { | |||
bool factory_os_unsupported = 1; | |||
// Zero fill is not supported. | |||
bool zero_fill_unsupported = 2; | |||
// Management config is not supported. | |||
bool mgmt_config_unsupported = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this has been flagged previously by Marcus, but I'll mention it again here in the interest of having the discussion more broadly. This field won't be a reliable indicator of what's going to happen.
Old devices that aren't aware of the mgmt_config
field in the request also won't be aware of the mgmt_config_unsupported
field in the response and therefore won't be able to set it to indicate their lack of awareness. Instead, they'll just silently ignore mgmt_config
altogether. You won't be able to distinguish between an old device that ignored this part of your request and a new device that processed it like you requested.
Splitting the boot parameters from the FactoryReset
service (like was proposed in another comment on the pull request) would make it easier to know what's going on. If you sent an old device something like SetBootstrapServerList
in a BootParameters
service, it would respond with an unimplemented error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I covered this in my comment above...
Again, I don't want to make a new service and clutter the namespace when this is fundamentally tied to FactoryReset. I think adding a new RPC to factory reset would be a better way to solve this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump the version of the service. Clients then have the option to ensure the service implements the new message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump the version of the service. Clients then have the option to ensure the service implements the new message.
gnoi package names don't include versions, hence it will not be visible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we are talking about the same thing, but you should be able to query service options via file descriptors via reflection if the server implementes it. Its convoluted, but its there.
Line 26 in bae5fb4
extend google.protobuf.FileOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. Indeed, I was thinking about a different thing (traditional grpc versioning, where the version is part of the namespace/package name). Thx for clarifying.
You can't make it generic because boot servers aren't generic. A device that only supports SZTP can't talk to a Bootz server and vice versa. You need to be able to say what the server is in addition to where the server is. |
The Bootz protocol specifically states the DHCP option is the same as SZTP (OPTION_V4_SZTP_REDIRECT or OPTION_V6_SZTP_REDIRECT). The difference is the URI format. So we specify what the server is by specifying bootz in the URI. |
Yes, but fundamentally factory reset has nothing to do with how the device boots. gRPC-based services provide a clear way to demarcate this boundary and we should leverage that.
I principally disagree. I don't see any tie to factoryreset, with the exception of the fact that it is used to initiate bootz in your environment. |
Just because Bootz and SZTP use URIs in similar ways doesn't mean An SZTP device cannot talk to a Bootz server. It would have to parse the URI (e.g., What happens when a new boot protocol comes along that isn't SZTP but still uses I don't think it's a good idea to rely on the device to parse URIs to figure out what it's supposed to do, and I don't think it's a good idea to shoehorn Bootz and SZTP URIs into the same field just because they happen to look alike. |
To elaborate on my previous comment, we can ask ourselves a few questions to determine why there is no "fundamental tie."
The new message defines parameters that bootz should consume during the next boot cycle (if enabled). It configures bootz to behave in a certain, special way. That's not the job of the "reset" functionality/service. |
Pull Request Test Coverage Report for Build 9763749476Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of making this specific to DHCP, why not add a feature to simply push a config on top of / modifying the factory default config?
ManagementConfig mgmt_config = 4; | ||
} | ||
|
||
message ManagementConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to use https://github.com/openconfig/bootz/blob/main/proto/bootz.proto#L225-L236 here? The idea being:
- factory reset the config
- apply the attached config. (which might include disabling dhcp and anything else you want to override)
- reboot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that this is not a traditional config.
This is a special config, that should be consumed at the start of the bootz process (which is typically invoked before any startup/running-config is involved) and by the bootz daemon only (it has no meaning to the other system components).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bootconfig message contains a parameter bootloader_config
which is intended to contain items that are invoked/processed before any startup/running config is involved. If an implementation requires bootloader_config
to contain some data to enable/disable the DHCP client used during bootz, that is fine. If the implementation uses OC config to do this, that is also fine.
If my comment is not on-track with your concerns, maybe you can share more details about the implementation so we can try and map it to bootz. Happy to do this offline with you if necessary and then we can follow up with some proposal here.
message BootConfig {
// Proprietary key-value parameters that are required as part of boot
// configuration (e.g., feature flags, or vendor-specific hardware knobs).
google.protobuf.Struct metadata = 1;
// Native format vendor configuration.
bytes vendor_config = 2;
// JSON rendered OC configuration.
bytes oc_config = 3;
// Bootloader key-value parameters that are required as part of boot
// configuration.
google.protobuf.Struct bootloader_config = 4;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LimeHat let me know what you think. Would like to keep this PR moving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an implementation requires bootloader_config to contain some data to enable/disable the DHCP client used during bootz, that is fine. If the implementation uses OC config to do this, that is also fine.
There's a bit more to this proposal than a simple enablement/disablement of DHCP.
The core part of the bootz protocol is a DHCP response. It includes not only information about IP config, but also the bootstrap URL(s).
This proposal, in essence, is a way to substitute a real DHCP response with a pre-defined static message received via gNOI (pseudo-DHCP).
There are different ways to store this data. It can be stored in bootloader parameters (as you indicated, but this will be more than a flag), in can be stored in persistent memory (e.g. as a file or another implementation-dependent data structure). Probably it can't be stored as OpenConfig data (for instance, I don't think you can specify bootstrap URLs; and if the author wants to preserve compatibility with FactoryReset
, it cannot be stored as a regular bootstrap cfg which is supposed to be erased during the reset). As a user, you probably don't to be concerned with implementation-specific details in order to use this.
I also don't want to couple this data with BootConfig
message, for a number of reasons, including
- in my opinion, these functions are logically independent, and,
- overloading this structure will require the user to know and submit unneeded data to simply enable this pseudo-dhcp thing (e.g. the
bytes vendor_config
field will have to be present), - the whole
SetBootConfigRequest
RPC is designed to replace the data that was received from a bootstrap server, and that data only.
Personally, I still think that a new service is the best approach. If you'd prefer to extend the existing BootConfig
service, I would suggest to create a new RPC for this feature, that seems like a reasonable middle ground.
Feel free to ping me in chat if you want to discuss further offline.
Is this proposed change specifically only for testing? I.e., are there any real deployment cases that would make use of these API parameters and functionality. I'm slightly nervous of a proposal to extend the public API if it is only intended to be used during testing scenarios. |
As discussed in the Community meeting a few weeks ago we are going to create a test only space to put this. |
For Bootz testing we want an interface to skip DHCP boot to be able to write smaller integration tests. One test should DHCP boot up to the point of reaching out to the Bootz server. Another test should skip DHCP boot and test the remaining bootz protocol to get a functioning device.