-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Creating friendly functions for establishing new controllers on existing or new fabrics #37009
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1681,6 +1681,23 @@ def wait_for_user_input(self, | |
logging.info("========= EOF on STDIN =========") | ||
return None | ||
|
||
def create_new_controller_on_new_fabric(self, nodeid: int = 2, vendorid: bytes = 0xFFF1, fabricid: int = 1): | ||
""" | ||
Create new fabric and controller for commissioning | ||
""" | ||
new_cert_auth = self.certificate_authority_manager.NewCertificateAuthority() | ||
new_fabric_admin = new_cert_auth.NewFabricAdmin(vendorId=vendorid, fabricId=fabricid) | ||
new_controller = new_fabric_admin.NewController(nodeId=nodeid) | ||
return new_controller | ||
|
||
def create_new_controller_on_existing_fabric(self, nodeid: int = 2): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking aloud (feedback please?) could we combine these so that we do not have 2 verbose variants? It seems to me we have generally the same function, except we either use the current fabric or create a new one. So maybe some signature like: @dataclass
class NewFabricInfo:
vendorId: int = 0xFFF1
fabricId: int = 1
def new_controller(self, nodeid: int = 2, new_fabric: Optional[NewFabricInfo] = None):
if new_fabric is not None:
fabric_admin = ....
else:
fabric_admin = ...
return fabric_admin.NewController(nodeId=nodeId) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also fine. I didn't think too hard about it when I created the issue other than "this code is yucky, let's make it less yucky in some way" |
||
""" | ||
Create new controller on an already established fabric | ||
""" | ||
current_fabric_admin = self.certificate_authority_manager.activeCaList[0].adminList[0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aside for the comment above, I wonder about the syntax here: this is restricted to activeCaList[0] only (why are we not supporting other indices?) and also it seems to replace a one-liner (albeit a very long one liner....) like why do we place this on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. activeCaList[0] is where the default contoller is created. So 0 should be a default, but yeah, it would be good to be able to create ex. new controller on new fabric index 1, second controller on that newly created fabric. |
||
new_controller = current_fabric_admin.NewController(nodeId=nodeid) | ||
return new_controller | ||
|
||
|
||
def generate_mobly_test_config(matter_test_config: MatterTestConfig): | ||
test_run_config = TestRunConfig() | ||
|
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.
bytes for 0xFFF1 does not look like the correct type for vendorid. Something is mismatched here