Basic Get ANC Operation Status

This sample gets the status of a Cisco Adaptive Network Control (ANC) operation.

Prerequisites

Running

To run this sample execute the sample/basic/basic_anc_get_operation_status.py script as follows:

python sample/basic/basic_anc_get_operation_status.py

If information can be retrieved successfully for the operation, the output should appear similar to the following:

{
  status object
}

Otherwise, this will be the result indicating that the operating with the corresponding ID was not found:

{
    "204": "no content"
}

Details

The majority of the sample code is shown below:

with DxlClient(config) as dxl_client:

    # Connect to the fabric
    dxl_client.connect()

    print("Connected to DXL fabric.", flush=True)

    # Create client wrapper
    client = CiscoPxGridClient(dxl_client)

    # Invoke 'get operation status'
    resp_dict = client.anc.get_operation_status("1")

    # Print out the response (convert dictionary to JSON for pretty
    # printing)
    print("Response:\n{0}".format(
        MessageUtils.dict_to_json(resp_dict, pretty_print=True)))

Once a connection is established to the DXL fabric, a dxlciscopxgridclient.client.CiscoPxGridClient instance is created which will be used to communicate with Cisco pxGrid.

Next, the dxlciscopxgridclient.client.AncClientCategory.get_operation_status() method.

The final step is to display the contents of the returned dictionary (dict) which contains the results of the attempt to retrieve the operation status.