![]() |
Open Kilda Java Documentation
|
Functions | |
def | is_forward_cookie (cookie) |
def | is_reverse_cookie (cookie) |
def | cookie_to_hex (cookie) |
def | is_same_direction (first, second) |
def | choose_output_action (input_vlan_id, output_vlan_id) |
def | get_one_switch_rules (src_switch, src_port, src_vlan, dst_port, dst_vlan, bandwidth, flowid, cookie, meter_id, output_action, k) |
def | get_rules (src_switch, src_port, src_vlan, dst_switch, dst_port, dst_vlan, bandwidth, transit_vlan, flowid, cookie, flowpath, meter_id, output_action, k) |
def | build_rules (flow) |
def | remove_flow (flow, parent_tx=None) |
def | merge_flow_relationship (flow_data, tx=None) |
def | merge_flow_segments (_flow, tx=None) |
def | get_flow_path (flow) |
def | delete_flow_segments (flow, tx=None) |
def | fetch_flow_segments (flowid, parent_cookie) |
def | update_flow_segment_available_bw (flow, tx=None) |
def | update_isl_bandwidth (src_switch, src_port, dst_switch, dst_port, tx=None) |
def | store_flow (flow, tx=None) |
def | hydrate_flow (one_row) |
def | get_old_flow (new_flow) |
def | get_flows () |
def | precreate_switches (tx, nodes) |
def | get_flow_segments_by_dst_switch (switch_id) |
def | get_flows_by_src_switch (switch_id) |
def | validate_switch_rules (switch_id, switch_rules) |
def | build_commands_to_sync_rules (switch_id, switch_rules) |
def | build_install_command_from_segment (segment) |
def | get_flow_by_id_and_cookie (flow_id, cookie) |
def | get_flow_segment_by_src_switch_and_cookie (switch_id, parent_cookie) |
Variables | |
graph = db.create_p2n_driver() | |
logger = logging.getLogger(__name__) | |
list | default_rules |
int | cookie_flag_forward = 0x4000000000000000 |
int | cookie_flag_reverse = 0x2000000000000000 |
def topologylistener.flow_utils.build_commands_to_sync_rules | ( | switch_id, | |
switch_rules | |||
) |
Build install commands to sync provided rules with the switch flows.
Definition at line 540 of file flow_utils.py.
def topologylistener.flow_utils.build_install_command_from_segment | ( | segment | ) |
Build a command to install required rules for the segment destination.
Definition at line 577 of file flow_utils.py.
def topologylistener.flow_utils.build_rules | ( | flow | ) |
Definition at line 136 of file flow_utils.py.
def topologylistener.flow_utils.choose_output_action | ( | input_vlan_id, | |
output_vlan_id | |||
) |
Definition at line 75 of file flow_utils.py.
def topologylistener.flow_utils.cookie_to_hex | ( | cookie | ) |
Definition at line 62 of file flow_utils.py.
def topologylistener.flow_utils.delete_flow_segments | ( | flow, | |
tx = None |
|||
) |
Whenever adjusting flow segments, always update available bandwidth. Even when creating a flow where we might remove anything old and then create the new .. it isn't guaranteed that the old segments are the same as the new segements.. so update bandwidth to be save.
Definition at line 277 of file flow_utils.py.
def topologylistener.flow_utils.fetch_flow_segments | ( | flowid, | |
parent_cookie | |||
) |
:param flowid: the ID for the entire flow, typically consistent across updates, whereas the cookie may change :param parent_cookie: the cookie for the flow as a whole; individual segments may vary :return: array of segments
Definition at line 297 of file flow_utils.py.
def topologylistener.flow_utils.get_flow_by_id_and_cookie | ( | flow_id, | |
cookie | |||
) |
Definition at line 619 of file flow_utils.py.
def topologylistener.flow_utils.get_flow_path | ( | flow | ) |
As commented elsewhere, current algorithm for flow path is to use both endpoints of a segment, each as their own node. So, make sure we have an even number of them.
Definition at line 263 of file flow_utils.py.
def topologylistener.flow_utils.get_flow_segment_by_src_switch_and_cookie | ( | switch_id, | |
parent_cookie | |||
) |
Definition at line 631 of file flow_utils.py.
def topologylistener.flow_utils.get_flow_segments_by_dst_switch | ( | switch_id | ) |
Definition at line 453 of file flow_utils.py.
def topologylistener.flow_utils.get_flows | ( | ) |
Definition at line 417 of file flow_utils.py.
def topologylistener.flow_utils.get_flows_by_src_switch | ( | switch_id | ) |
Definition at line 470 of file flow_utils.py.
def topologylistener.flow_utils.get_old_flow | ( | new_flow | ) |
Definition at line 385 of file flow_utils.py.
def topologylistener.flow_utils.get_one_switch_rules | ( | src_switch, | |
src_port, | |||
src_vlan, | |||
dst_port, | |||
dst_vlan, | |||
bandwidth, | |||
flowid, | |||
cookie, | |||
meter_id, | |||
output_action, | |||
k | |||
) |
Definition at line 83 of file flow_utils.py.
def topologylistener.flow_utils.get_rules | ( | src_switch, | |
src_port, | |||
src_vlan, | |||
dst_switch, | |||
dst_port, | |||
dst_vlan, | |||
bandwidth, | |||
transit_vlan, | |||
flowid, | |||
cookie, | |||
flowpath, | |||
meter_id, | |||
output_action, | |||
k | |||
) |
Definition at line 92 of file flow_utils.py.
def topologylistener.flow_utils.hydrate_flow | ( | one_row | ) |
:param one_row: The typical result from query - ie MATCH (a:switch)-[r:flow]->(b:switch) RETURN r :return: a fully dict'd object
Definition at line 371 of file flow_utils.py.
def topologylistener.flow_utils.is_forward_cookie | ( | cookie | ) |
Definition at line 42 of file flow_utils.py.
def topologylistener.flow_utils.is_reverse_cookie | ( | cookie | ) |
Definition at line 52 of file flow_utils.py.
def topologylistener.flow_utils.is_same_direction | ( | first, | |
second | |||
) |
Definition at line 70 of file flow_utils.py.
def topologylistener.flow_utils.merge_flow_relationship | ( | flow_data, | |
tx = None |
|||
) |
This function focuses on just creating the starting/ending switch relationship for a flow.
Definition at line 164 of file flow_utils.py.
def topologylistener.flow_utils.merge_flow_segments | ( | _flow, | |
tx = None |
|||
) |
This function creates each segment relationship in a flow, and then it calls the function to update bandwidth. This should always be down when creating/merging flow segments. To create segments, we leverages the flow path .. and the flow path is a series of nodes, where each 2 nodes are the endpoints of an ISL.
Definition at line 202 of file flow_utils.py.
def topologylistener.flow_utils.precreate_switches | ( | tx, | |
nodes | |||
) |
Definition at line 440 of file flow_utils.py.
def topologylistener.flow_utils.remove_flow | ( | flow, | |
parent_tx = None |
|||
) |
Deletes the flow and its flow segments. Start with flow segments (symmetrical mirror of store_flow). Leverage a parent transaction if it exists, otherwise create / close the transaction within this function. - flowid **AND** cookie are *the* primary keys for a flow: - both the forward and the reverse flow use the same flowid NB: store_flow is used for uni-direction .. whereas flow_id is used both directions .. need cookie to differentiate
Definition at line 143 of file flow_utils.py.
def topologylistener.flow_utils.store_flow | ( | flow, | |
tx = None |
|||
) |
Create a :flow relationship between the starting and ending switch, as well as create :flow_segment relationships between every switch in the path. NB: store_flow is used for uni-direction .. whereas flow_id is used both directions .. need cookie to differentiate :param flow: :param tx: The transaction to use, or no transaction. :return:
Definition at line 352 of file flow_utils.py.
def topologylistener.flow_utils.update_flow_segment_available_bw | ( | flow, | |
tx = None |
|||
) |
Definition at line 311 of file flow_utils.py.
def topologylistener.flow_utils.update_isl_bandwidth | ( | src_switch, | |
src_port, | |||
dst_switch, | |||
dst_port, | |||
tx = None |
|||
) |
This will update the available_bandwidth for the isl that matches the src/dst information. It does this by looking for all flow segments over the ISL, where ignore_bandwidth = false. Because there may not be any segments, have to use "OPTIONAL MATCH"
Definition at line 322 of file flow_utils.py.
def topologylistener.flow_utils.validate_switch_rules | ( | switch_id, | |
switch_rules | |||
) |
Perform validation of provided rules against the switch flows.
Definition at line 484 of file flow_utils.py.
int topologylistener.flow_utils.cookie_flag_forward = 0x4000000000000000 |
Definition at line 38 of file flow_utils.py.
int topologylistener.flow_utils.cookie_flag_reverse = 0x2000000000000000 |
Definition at line 39 of file flow_utils.py.
list topologylistener.flow_utils.default_rules |
Definition at line 34 of file flow_utils.py.
topologylistener.flow_utils.graph = db.create_p2n_driver() |
Definition at line 31 of file flow_utils.py.
topologylistener.flow_utils.logger = logging.getLogger(__name__) |
Definition at line 32 of file flow_utils.py.