ostinato.core module¶
This is the core module for the Ostinato Python API. All drone configuration is done by creating an instance of the DroneProxy
class and calling its various methods subsequently.
Module Classes¶
DroneProxy class¶
DroneProxy(host_name, port_number=7878)
DroneProxy acts as a proxy to a Drone instance. A method invoked on this class will be trigerred on the actual Drone instance being proxied.
Class methods¶
disconnect¶
DroneProxy.disconnect()
Disconnect from the Drone instance
connect¶
DroneProxy.connect()
Connect to the Drone instance
hostName¶
DroneProxy.hostName() : str(unicode)
Returns the hostname of the Drone which is being proxied by this DroneProxy object
portNumber¶
DroneProxy.portNumber() : int
Returns the TCP port number of the Drone which is being proxied by this DroneProxy object
saveCaptureBuffer¶
DroneProxy.saveCaptureBuffer(buffer, file_name)
Save the capture buffer in a PCAP file
getPortIdList¶
DroneProxy.getPortIdList(Void) : PortIdList
Fetches the list of all available port ids.
Returns PortIdList
getPortConfig¶
DroneProxy.getPortConfig(PortIdList) : PortConfigList
Fetches port configuration for each port in the given PortIdList.
Returns a PortConfigList
modifyPort¶
DroneProxy.modifyPort(PortConfigList) : Ack
Modifies port configuration as specified for all ports in PortConfigList. Please note that not all port attributes can be modified.
Returns Ack
getStreamIdList¶
DroneProxy.getStreamIdList(PortId) : StreamIdList
Fetches the list of stream ids for the given PortId
Returns StreamIdList
getStreamConfig¶
DroneProxy.getStreamConfig(StreamIdList) : StreamConfigList
Fetches configuration for each stream in the given StreamIdList. A stream id list can be associated with only one port. To fetch stream configuration for multiple ports, call the API multiple times.
Returns StreamConfigList
addStream¶
DroneProxy.addStream(StreamIdList) : Ack
Adds a list of stream ids to a port. The list can also include a single stream id. This API just adds a stream id - the stream will be created with default configuration. To configure the stream call modifyStream() after adding the stream id.
Returns Ack
deleteStream¶
DroneProxy.deleteStream(StreamIdList) : Ack
Deletes the streams corresponding to the stream ids in StreamIdList
Returns Ack
modifyStream¶
DroneProxy.modifyStream(StreamConfigList) : Ack
Modifies stream configuration as specified for all streams in StreamConfigList.
Returns Ack
build¶
DroneProxy.build(BuildConfig) : Ack
Builds all packets for all streams configured on the port specified in BuildConfig. Calling this API before startTransmit() ensures that the packet transmit starts immediately on calling the latter.
If startTransmit() is called without calling build(), it will first build the packets and then start transmit.
This API was introduced in ver 1.0
Returns Ack
startTransmit¶
DroneProxy.startTransmit(PortIdList) : Ack
Starts transmit on each port in the given PortIdList
Returns Ack
stopTransmit¶
DroneProxy.stopTransmit(PortIdList) : Ack
Stops transmit on each port in the given PortIdList
Returns Ack
startCapture¶
DroneProxy.startCapture(PortIdList) : Ack
Starts transmit on each port in the given PortIdList
Returns Ack
stopCapture¶
DroneProxy.stopCapture(PortIdList) : Ack
Stops transmit on each port in the given PortIdList
Returns Ack
getCaptureBuffer¶
DroneProxy.getCaptureBuffer(PortId) : CaptureBuffer
Fetches the captured buffer of packets for the given PortId. Calling this API will implicitly stop the capture.
Returns Ack
getStats¶
DroneProxy.getStats(PortIdList) : PortStatsList
Fetches the port statistics for each port in the given PortIdList
Returns PortStatsList
clearStats¶
DroneProxy.clearStats(PortIdList) : Ack
Clears all the port statistics for each port in the given PortIdList
Returns Ack
getDeviceGroupIdList¶
DroneProxy.getDeviceGroupIdList(PortId) : DeviceGroupIdList
Fetches the list of device group ids for the given PortId
getDeviceGroupConfig¶
DroneProxy.getDeviceGroupConfig(DeviceGroupIdList) : DeviceGroupConfigList
Fetches configuration for each device group in the given DeviceGroupIdList. A device group id list can be associated with only one port. To fetch device group configuration for multiple ports, call the API multiple times.
Returns DeviceGroupConfigList
addDeviceGroup¶
DroneProxy.addDeviceGroup(DeviceGroupIdList) : Ack
Adds a list of device group ids to a port. The list can also include a single device group id. This API just adds a device group id - the device group will be created with default configuration. To configure the device group call modifyDeviceGroup() after adding the device group id.
Returns Ack
deleteDeviceGroup¶
DroneProxy.deleteDeviceGroup(DeviceGroupIdList) : Ack
Deletes the device groups corresponding to the device group ids in DeviceGroupIdList
Returns Ack
modifyDeviceGroup¶
DroneProxy.modifyDeviceGroup(DeviceGroupConfigList) : Ack
Modifies device group configuration as specified for all device groups in DeviceGroupConfigList.
Returns Ack
getDeviceList¶
DroneProxy.getDeviceList(PortId) : PortDeviceList
Fetches the list of devices for the given PortId. This will include all devices across all device groups on that port.
Returns PortDeviceList
resolveDeviceNeighbors¶
DroneProxy.resolveDeviceNeighbors(PortIdList) : Ack
Triggers ARP/ND resolution for all ports in the given PortIdList. ARP/ND requests will be sent for each device gateway IP address and for all stream destination IPs that are in the same subnet as the device itself.
The ARP/ND replies received in response to these requests will be stored in the Neighbor Table (i.e. ARP/ND cache)
Returns Ack
clearDeviceNeighbors¶
DroneProxy.clearDeviceNeighbors(PortIdList) : Ack
Clears the Neighbor Table.
Returns Ack
getDeviceNeighbors¶
DroneProxy.getDeviceNeighbors(PortId) : PortNeighborList
Fetches the Neighbor Table (i.e. ARP/ND cache) for the given PortId. Entries in the table will be for all devices across all device groups configured on the port.
getStreamStats¶
DroneProxy.getStreamStats(StreamGuidList) : StreamStatsList
Fetches the stream statistics for each port in the given StreamGuidList. Specify the GUIDs for which stats are required by populating StreamGuidList.stream_guid
. If not populated, stats for all GUIDs are returned.
Returns StreamStatsList
getStreamStatsDict¶
DroneProxy.getStreamStatsDict(StreamGuidList) : StreamStatsDict
Convenience method for fetching stream stats. Returns an object containing port/sguid dictionaries for easier access e.g.
stream_stats = drone.getStreamStatsDict(guid_list)
stream_stats.sguid[101].port[1].tx_pkts
stream_stats.port[1].sguid[101].rx_bytes
In addition, you can also retrieve totals across ports, e.g.
stream_stats.port[1].total.rx_pkts
stream_stats.port[1].total.rx_bytes
stream_stats.port[1].total.tx_pkts
stream_stats.port[1].total.tx_bytes
and totals across sguids -
stream_stats.sguid[101].total.tx_pkts
stream_stats.sguid[101].total.rx_pkts
stream_stats.sguid[101].total.pkt_loss
This method is a wrapper around getStreamStats
clearStreamStats¶
DroneProxy.clearStreamStats(StreamGuidList) : Ack
Clears the stream statistics for each port in the given StreamGuidList. Specify the GUIDs for which stats should be cleared by populating StreamGuidList.stream_guid
. If not populated, stats for all GUIDs are cleared.
Returns Ack