Closed zorkon7 closed 3 years ago
Every method that is an operation (LoadConfig, AssignPorts, ExportConfig etc) can be executed asynchronously by specifying the async_operation to be true. If async_operation is true the method will return immediately and the .get_async_response() should be used at some point to get the original operation response.
Code generation for every operation in a class will include documentation for an async_operation parameter as follows.
class IxNetwork(Base):
...
def LoadConfig(self, *args, **kwargs):
"""Executes the loadConfig operation on the server.
loadConfig(Arg1=href, async_operation=False)
---------------------
- Arg1 (obj(ixnetwork_restpy.files.Files)):
- async_operation (bool=False): True to execute the operation asynchronously.
Any subsequent rest api calls made through the Connection class will block until the operation is complete.
Raises
------
- NotFoundError: The requested resource does not exist on the server
- ServerError: The server has encountered an uncategorized error condition
"""
ixnetwork = TestPlatform().Session().add().Ixnetwork
# load a configuration asynchronously (do not poll)
ixnetwork.LoadConfig(Arg1=Files('48port_raw_traffic.ixncfg'), async_operation=True)
# additional dut configuration can take place here while
# the async LoadConfig operation is executing
# wait for the async operation to complete and get the response if any
response = ixnetwork.get_async_response()
This is now supported in ixnetwork_restpy v1.1.0
Currently the ixnetwork.LoadConfig is taking a lot of time waiting for larger configurations to load. Requesting non blocking way to load configuration (Similar async way is found in ixnetwork.StartAllProtocols)