dxlciscopxgridclient.client module

class dxlciscopxgridclient.client.AncClientCategory(pxgrid_client)

Bases: dxlciscopxgridclient.client._BaseClientCategory

A client class for interacting with Cisco Adaptive Network Control (ANC) functionality via pxGrid.

Constructor parameters:

Parameters:pxgrid_client (CiscoPxGridClient) -- The pxGrid client object.
add_apply_endpoint_policy_callback(callback)

Register an object to called back upon when an ANC "apply endpoint policy" event is received.

Parameters:callback (dxlciscopxgridclient.callbacks.AncApplyEndpointPolicyCallback) -- The callback to register.
add_clear_endpoint_policy_callback(callback)

Register an object to called back upon when an ANC "clear endpoint policy" event is received.

Parameters:callback (dxlciscopxgridclient.callbacks.AncClearEndpointPolicyCallback) -- The callback to register.
add_create_policy_callback(callback)

Register an object to called back upon when an ANC "create endpoint policy" event is received.

Parameters:callback (dxlciscopxgridclient.callbacks.AncCreatePolicyCallback) -- The callback to register.
add_delete_policy_callback(callback)

Register an object to called back upon when an ANC "delete endpoint policy" event is received.

Parameters:callback (dxlciscopxgridclient.callbacks.AncDeletePolicyCallback) -- The callback to register.
add_update_policy_callback(callback)

Register an object to called back upon when an ANC "update endpoint policy" event is received.

Parameters:callback (dxlciscopxgridclient.callbacks.AncUpdatePolicyCallback) -- The callback to register.
apply_endpoint_policy_by_ip(ip_address, policy_name)

Apply a policy to an endpoint by its IP address.

Parameters:
  • ip_address (str) -- IP address of the endpoint.
  • policy_name (str) -- Name of the policy to apply.
Returns:

Results of the attempt to apply the endpoint policy. On a successful application, the results should look similar to this:

{
    "ancStatus": "success"
}

Return type:

dict

Raises:

Exception -- If the supplied policy name has already been applied to the endpoint, the policy name has not been defined, or if no session has been defined for an endpoint which corresponds to the IP address.

apply_endpoint_policy_by_mac(mac_address, policy_name)

Apply a policy to an endpoint by its MAC address.

Parameters:
  • mac_address (str) -- MAC address of the endpoint.
  • policy_name (str) -- Name of the policy to apply.
Returns:

Results of the attempt to apply the endpoint policy. On a successful application, the results should look similar to this:

{
    "ancStatus": "success"
}

Return type:

dict

Raises:

Exception -- If the supplied policy name has already been applied to the endpoint or the policy name has not been defined.

clear_endpoint_policy_by_ip(ip_address)

Clear the policy for an endpoint by its IP address.

Parameters:ip_address (str) -- IP address of the endpoint.
Returns:Results of the attempt to clear the endpoint policy. On a successful clear attempt, the results should look similar to this:
{
    "ancStatus": "success"
}
Return type:dict
Raises:Exception -- If no policy has been associated with the endpoint.
clear_endpoint_policy_by_mac(mac_address)

Clear the policy for an endpoint by its MAC address.

Parameters:mac_address (str) -- MAC address of the endpoint.
Returns:Results of the attempt to clear the endpoint policy. On a successful clear attempt, the results should look similar to this:
{
    "ancStatus": "success"
}
Return type:dict
Raises:Exception -- If no policy has been associated with the endpoint.
get_endpoint_by_ip(ip_address)

Get information for an endpoint by its IP address.

Parameters:ip_address (str) -- IP address of the endpoint.
Returns:The endpoint information, which should look similar to this:
{
    "ancEndpoint": [
        {
            "macAddress": "00:11:22:33:44:55",
            "policyName": "quarantine_policy"
        }
    ],
    "ancStatus": "success"
}
Return type:dict
Raises:Exception -- If no policy has been associated with the endpoint or if no session has been defined for an endpoint which corresponds to the IP address.
get_endpoint_by_mac(mac_address)

Get information for an endpoint by its MAC address.

Parameters:mac_address (str) -- MAC address of the endpoint.
Returns:The endpoint information, which should look similar to this:
{
    "ancEndpoint": [
        {
            "macAddress": "00:11:22:33:44:55",
            "policyName": "quarantine_policy"
        }
    ],
    "ancStatus": "success"
}
Return type:dict
Raises:Exception -- If no policy has been associated with the endpoint.
retrieve_all_policies()

Retrieve information for all ANC policies.

Returns:The policy information, which should look similar to this:
{
    "ancStatus": "success",
    "ancpolicy": [
        {
            "action": [
                "ShutDown"
            ],
            "name": "shutdown_policy"
        },
        {
            "action": [
                "Quarantine"
            ],
            "name": "quarantine_policy"
        }
    ]
}
Return type:dict
retrieve_policy_by_name(policy_name)

Retrieve information for an ANC policy by name.

Parameters:policy_name (str) -- Name of the policy.
Returns:The policy information, which should look similar to this:
{
    "ancStatus": "success",
    "ancpolicy": [
        {
            "action": [
                "Quarantine"
            ],
            "name": "quarantine_policy"
        }
    ]
}
Return type:dict
Raises:Exception -- If the policy name has not been defined.
class dxlciscopxgridclient.client.CiscoPxGridClient(dxl_client)

Bases: dxlbootstrap.client.Client

The "Cisco pxGrid DXL Client Library" client wrapper class.

Constructor parameters:

Parameters:dxl_client -- The DXL client to use for communication with the fabric
anc

Retrieves a client object for use in interacting with Cisco Adaptive Network Control (ANC) functionality via pxGrid.

Returns:The ANC instance.
Return type:AncClientCategory
eps

Retrieves a client object for use in interacting with Cisco Endpoint Protection Service (EPS) functionality via pxGrid.

Returns:The EPS instance.
Return type:EpsClientCategory
identity

Retrieves a client object for use in interacting with identity services in Cisco pxGrid.

Returns:The identity client instance.
Return type:IdentityClientCategory
class dxlciscopxgridclient.client.EpsClientCategory(pxgrid_client)

Bases: dxlciscopxgridclient.client._BaseClientCategory

A client class for interacting with Cisco Endpoint Protection Service (EPS) functionality via pxGrid.

Constructor parameters:

Parameters:pxgrid_client (CiscoPxGridClient) -- The pxGrid client object.
send_mitigation_action_by_ip(ip_address, action)

Send an EPS mitigation action for an endpoint IP address.

Parameters:
Returns:

Results of the attempt to send the action. The results for a successful send should look similar to this:

{
    "gid": "150",
    "macInterface": "00:11:22:33:44:55",
    "mitigationStatus": "complete"
}

Return type:

dict

Raises:

Exception -- If no session has been established for an endpoint which corresponds to the IP address.

send_mitigation_action_by_mac(mac_address, action)

Send an EPS mitigation action for an endpoint MAC address.

Parameters:
Returns:

Results of the attempt to send the action. The results for a successful send should look similar to this:

{
    "gid": "150",
    "macInterface": "00:11:22:33:44:55",
    "mitigationStatus": "complete"
}

Return type:

dict

class dxlciscopxgridclient.client.IdentityClientCategory(pxgrid_client)

Bases: dxlciscopxgridclient.client._BaseClientCategory

A client class for interacting with identity services in Cisco pxGrid.

Constructor parameters:

Parameters:pxgrid_client (CiscoPxGridClient) -- The pxGrid client object.
add_session_callback(callback)

Register an object to called back upon when a session event is received.

Parameters:callback (dxlciscopxgridclient.callbacks.IdentitySessionCallback) -- The callback to register.