Which two PyEZ object methods are included by default when using a Python context manager? (Choose two.)
Correct Answer: A,B
When using a Python context manager with Junos PyEZ, two key methods are automatically included:
* open()andclose(): These methods are used to establish and terminate a connection to a Junos device.
When you use a context manager (thewithstatement),open()is called when entering the block, andclose() is called when exiting, ensuring the connection is properly managed.
* lock()andunlock(): These methods are used to lock the configuration database to prevent other users from making changes while you are working on it. When using a context manager,lock()is called at the start of the block, andunlock()is called at the end, ensuring safe configuration changes.
Supporting References:
* Junos PyEZ Documentation:The documentation explains how context managers work in PyEZ, including the automatic invocation ofopen(),close(),lock(), andunlock()methods.