MFLib mf_timestamp¶
MFLib’s Timestamp functions are defined in this class.
- class mflib.mf_timestamp.mf_timestamp(slice, container_name)¶
Creates precision timestamps.
- deploy_influxdb_dashboard(dashboard_file, influxdb_node_name, bind_mount_volume)¶
Uploads a dashboard template file from Jupyterhub to influxdb and apply the template :param dashboard_file: path of the dashboard file on Jupyterhub :type dashboard_file: str :param influxdb_node_name: which fabric node is influxdb running on :type influxdb_node_name: str :param bind_mount_volume: bind mount volume of the influxdb docker container :type bind_mount_volume: str
- download_file_from_influxdb(data_node, data_type, influxdb_node_name, local_file)¶
Downlaods the .csv data file from the influxdb container to juputerhub :param data_node: where the data comes from :type data_node: str :param data_type: packet_timestamp or event timestamp :type data_type: str :param influxdb_node_name: which fabric node is influxdb running on :type influxdb_node_name: str :param local_file: path on Jupyterhub for the downlaod .csv file :type local_file: str
- download_timestamp_file(node, data_type, local_file, bind_mount_volume)¶
Downloads the collected timestamp file to Jupyterhub Use fablib node.download_file() to download the timestamp data file that can be accessed from the bind mount volume :param node: fabric node on which the timestamp docker container is running :type node: fablib.node :param data_type: packet_timestamp or event timestamp :type data_type: str :param local_file: path on Jupyterhub for the download file :type local_file: str :param bind_mount_volume: bind mount volume of the running timestamp docker container :type bind_mount_volume: str
- download_timestamp_from_influxdb(node, data_type, bucket, org, token, name, influxdb_ip=None)¶
Downloads the timestamp data from influxdb :param node: fabric node on which the timestamp docker container is running :type node: fablib.node :param data_type: packet_timestamp or event timestamp :type data_type: str :param bucket: name of the influxdb bucket to dump data to :type bucket: str :param org: org of the bucket :type org: str :param token: token of the bucket :type token: str :param name: name of the timestamp experiment :type name: str :param influxdb_ip: the IP address of the node where the influxdb container is running :type influxdb_ip: str, optional
- get_event_timestamp(node, name, verbose=False)¶
Prints the collected event timestamp by calling timestamptool.py in the timestamp docker container running on node It reads the local event timestamp file and prints the result :param node: fabric node on which the timestamp docker container is running :type node: fablib.node :param name: name of the event timestamp experiment :type name: str
- get_packet_timestamp(node, name, verbose=False)¶
Prints the collected packet timestamp by calling timestamptool.py in the timestamp docker container running on the node It reads the local packet timestamp file and prints the result :param node: fabric node on which the timestamp docker container is running :type node: fablib.node :param name: name of the packet timestamp experiment :type name: str
- get_query_for_csv(data_node, name, data_type, bucket, org, token)¶
Generates a .csv file in the influxdb container for the query data :param data_node: where the data comes from :type data_node: str :param name: name of the timestamp experiment :type name: str :param data_type: packet_timestamp or event timestamp :type data_type: str :param bucket: name of the influxdb bucket to dump data to :type bucket: str :param org: org of the bucket :type org: str :param token: token of the bucket :type token: str :param influxdb_node_name: which fabric node is influxdb running on :type influxdb_node_name: str
- plot_event_timestamp(json_obj)¶
Plots the count of events :param json_obj: list of json objects with timestamp info :type json_obj: list
- plot_packet_timestamp(json_obj)¶
Plots the count of packets captured :param json_obj: list of json objects with timestamp info :type json_obj: list
- read_from_local_file(file)¶
Reads and processes the downloaded timestamp data file :param file: file path on Jupyterhub for the final timestamp result :type file: str
- record_event_timestamp(node, name, event, description=None, verbose=False)¶
Records event timestamp by calling timestamptool.py in the timestamp docker container running on the node :param node: fabric node on which the timestamp docker container is running :type node: fablib.node :param name: name of the event timestamp experiment :type name: str :param event: name of the event :type event: str :param description: description of the event :type description: str, optional
- record_packet_timestamp(node, name, interface, ipversion, protocol, duration, host=None, port=None, verbose=False)¶
Records packet timestamp by calling timestamptool.py in the timestamp docker container running on the node :param node: fabric node on which the timestamp docker container is running :type node: fablib.node :param name: name of the packet timestamp experiment :type name: str :param interface: which interface tcpdump captures the packets :type interface: str :param ipversion: IPv4 or IPv6 :type ipversion: str :param protocol: tcp or udp :type protocol: str :param duration: seconds to run tcpdump :type duration: str :param host: host for tcpdump command :type host: str, optional :param port: port for tcpdump command :type port: str, optional
- upload_timestamp_to_influxdb(node, data_type, bucket, org, token, influxdb_ip=None)¶
Uploads the timestamp data to influxdb :param node: fabric node on which the timestamp docker container is running :type node: fablib.node :param data_type: packet_timestamp or event timestamp :type data_type: str :param bucket: name of the influxdb bucket to dump data to :type bucket: str :param org: org of the bucket :type org: str :param token: token of the bucket :type token: str :param influxdb_ip: IP of the node where influxdb container is running :type influxdb_ip: str, optional