core package¶
Submodules¶
core.basicHostIPCLayer module¶
core.defines module¶
Helper functions.
-
core.defines.decode_raw_ip_payload_src_dst(buf)¶ Get src,dst ip address from raw ip payload string
Parameters: buf – A string buffer containing raw ip payload Returns: A typle with source and destination IP strings
-
core.defines.get_ip_ethernet(buf)¶ Unpack the data within the Ethernet frame (the IP packet)
Pulling out src, dst, length, fragment info, TTL, and Protocol
Parameters: buf (str) – A string buffer containing the entire packet Returns: ip of type (dpkt.IP)
-
core.defines.get_ip_loopback(buf)¶ Unpack the data within the Ethernet frame (the IP packet)
Pulling out src, dst, length, fragment info, TTL, and Protocol
Parameters: buf (str) – A string buffer containing the entire packet Returns: ip of type (dpkt.IP)
-
core.defines.get_ip_sll(buf)¶ Unpack the data within the SLL frame (the IP packet)
Pulling out src, dst, length, fragment info, TTL, and Protocol
Parameters: buf (str) – A string buffer containing the entire packet Returns: ip of type (dpkt.IP)
-
core.defines.get_pkt_src_dst_IP(buf, dl_type=1)¶ Get src and dst IP from raw packet string
Parameters: - buf (str) – A string buffer containing the entire packet
- dl_type (int) – Link Layer type defined in dpkt.pcap. (Default ETH_TYPE_FRAME)
Returns: A tuple with source and destination IP strings
-
core.defines.get_raw_ip_pkt(buf, dl_type=1)¶ Get IP payload from raw packet string
Parameters: - buf (str) – A string buffer containing the entire packet
- dl_type (int) – Link Layer type defined in dpkt.pcap. (Default ETH_TYPE_FRAME)
Returns: A string buffer with IP payload
-
core.defines.getid()¶ Returns a random unique string ID
Returns: str
-
core.defines.inet_to_str(inet)¶ Convert inet object to a string
Parameters: inet (inet struct) – inet network address Returns: str of printable/readable IP address
-
core.defines.rpc_process()¶ Sends a batch processing GRPC request request.
Called by Melody to initiate processing of all read/write requests received in the last batch.
Returns: None
-
core.defines.rpc_read(readlist)¶ Makes a GRPC read request call to the proxy. It may be used to read some values from the power simulation.
It takes in as input a list of read requests and composes and sends a single GRPC read request to the proxy. It waits until the proxy sends a response and returns the values contained in the response or None if there was an error.
Parameters: readlist (list of tuples) – A list of tuples (objtype (str), objid (str), fieldtype (str)). Refer src/proto/pss.proto Returns: list of str or None
-
core.defines.rpc_write(writelist)¶ Makes a GRPC write request call to the proxy. It may be used to write some values to the power simulation
It takes in as input a list of write requests and composes and sends a single GRPC write request to the proxy. It waits until the proxy sends a response and returns the status response or None if there was an error.
Parameters: writelist (list of tuples) – A list of tuples (objtype (str), objid (str), fieldtype (str), value(str)). Refer src/proto/pss.proto Returns: list of int (Refer src/proto/pss.proto: WriteStatus) or None
-
core.defines.str_to_inet(str)¶ Convert string object to an inet
Parameters: str (str) – printable/readable IP address Returns: inet (inet struct) - an inet network address
core.disturbance_gen module¶
Disturbance generator
Initialize shared buffers used for communication with the main Melody process
Parameters: shared_buf_array – A shared buffer array object (defined in src/core/shared_buffer.py) Returns: None
-
core.disturbance_gen.main(path_to_disturbance_file)¶ Starts the disturbance generator and sends disturbances to the power simulation at specified relative timestamps
Disturbances and their relative timestamps are specified in a file according to the Disturbance message format defined in src/proto/configuration.proto
Parameters: path_to_disturbance_file (str) – Absolute path to file containing disturbances specified in Disturbance proto format. (Refer src/proto/configuration.proto : Disturbances) Returns: None
core.emulation_driver module¶
core.host module¶
core.kronos_helper_functions module¶
core.logger module¶
core.net_power module¶
core.parse_project_configuration module¶
core.pss_driver module¶
Drivers for interacting with power system simulator.