I am attempting to delete active connections for a particular IP using the ruby iControl gem. I want to mirror the functionality of the tmsh command :
delete /sys connection cs-client-addr
To do this, I’m trying to use System::Connections::delete_active_connection as detailed here. We are using the ruby iControl gem version 11.3.0.0. Here is sample code to delete a connection by IP :
def delete_active_connections(ip_addr)
result = conn["System.Connections"].delete_active_connection(["connections" => ["clientside_client" => {"address" => ip_addr}]])
result
end
This does not work and results in the error :
Exception:
Could not find element by name: address
I have not been able to find any working examples of System::Connections::delete_active_connection on devcentral. Does anyone have a working example or experience with this call? I have attempted specifying the entire connection (clientside_client, clientside_server, serverside_client, protocol) with ports, but get the same error. Any help would be appreciated.
in python, I have the following structure working (for get/delete). I’m asking internally about whether you can null a value you don’t want to match, but haven’t heard back yet.
Got this working with 0 for all ports and “0.0.0.0” for all IPs. I also had to change the format a bit. Evidently the ruby gem is not expecting a “connections” hash key, just an array. Thanks for the help, Jason.