-
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?
Conversation
j-ororke
commented
Jan 9, 2025
- This is to help resolve task filed by Cecille here: 465
- Created 2 friendly functions for establishing new controllers on new and existing fabrics
- This is to help resolve task filed: project-chip/matter-test-scripts#465 - Created 2 friendly functions for establishing new controllers on new and existing fabrics
Changed Files
|
PR #37009: Size comparison from f25f635 to 89c27a6 Full report (70 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
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 comment
The 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 comment
The 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"
@@ -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): |
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
""" | ||
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 comment
The 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 self.certificate_authority_manager.activeCaList[0].adminList[0].NewController(nodeid)
why do we place this on MatterBaseTest
class? this is a class with over 1500 lines of code already ... that is not good for maintainability. How about having certificate_authority_manager
have these methods? then instead of self.new_controller(....)
I call self.certificate_authority_manager.create_controller(....)
in some form of arguments. Likely we then control with activeCaList we use ... we could even have a union of existingCa vs NewCa.
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.
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.