def test_keys_match(): passive_nodes = os.getenv("RIFT_PASSIVE_NODES", "").split(",") res = RiftExpectSession("keys_match") if "node1" not in passive_nodes: check_rift_node1(res) if "node2" not in passive_nodes: check_rift_node2(res) if "node3" not in passive_nodes: check_rift_node3(res) res.stop()
def test_2n_l1_l3(): passive_nodes = os.getenv("RIFT_PASSIVE_NODES", "").split(",") les = LogExpectSession() res = RiftExpectSession("2n_l1_l3") if "node1" not in passive_nodes: check_rift_node1(res) check_log_node1(les) if "node2" not in passive_nodes: check_rift_node2(res) check_log_node2(les) res.stop()
def test_2n_un_l0(): passive_nodes = os.getenv("RIFT_PASSIVE_NODES", "").split(",") # Bring topology up les = LogExpectSession() res = RiftExpectSession("2n_un_l0") # Check that adjacency stays in 1-way, check offers, check levels if "node1" not in passive_nodes: check_rift_node1_intf_up(res) check_log_node1_intf_up(les) if "node2" not in passive_nodes: check_rift_node2_intf_up(res) check_log_node2_intf_up(les) # Done res.stop()
def test_neg_disagg_spf(): # Disable debug logging for large topologies such as multiple (it makes convergence too slow) res = RiftExpectSession("multiplane", start_converge_secs=45.0, reconverge_secs=20.0, log_debug=False) # E-W neighbors should not be present in south SPF check_ew_absence_in_south_spf(res) # E-W neighbors must be present in special SPF check_ew_in_special_spf(res) # Break spine_1_1_1 interfaces connected to ToFs to reach a fallen leaf situation res.interface_failure(node="spine_1_1_1", interface="if2", failure="failed") res.interface_failure(node="spine_1_1_1", interface="if3", failure="failed") # Check that leaf_1_0_1 and leaf_1_0_2 are not reachable # with south SPF of tof_1_1_1 and tof_1_2_2 check_fall_leafs_s_spf(res) # Check that leaf_1_0_1 and leaf_1_0_2 are reachable # using special SPF of tof_1_1_1 and tof_1_2_2 check_fall_leafs_sp_spf(res) res.stop()
def test_neg_disagg_spf_propagation(): # Disable debug logging for large topologies such as multiple (it makes convergence too slow) res = RiftExpectSession("multiplane", start_converge_secs=45.0, reconverge_secs=30.0, log_debug=False) # Break spine_1_1_1 interfaces connected to tof_1_2_1 (so a next hop should be removed from SPF) res.interface_failure(node="spine_1_1_1", interface="if2", failure="failed") # Check that spines lost a positive next hop for the negative disaggregated prefixes check_spine_positive_next_hops(res) # Break last spine_1_1_1 interface to reach a fallen leaf situation with first ToF plane res.interface_failure(node="spine_1_1_1", interface="if3", failure="failed") # Check that each spine loses all the positive next hops for the negative disaggregated prefixes # and computes only negative next hops check_spine_negative_disagg_spf(res) # Check that each leaf computed a negative next hops for the negative disaggregated prefixes check_leaf_negative_next_hops(res) res.stop()
def test_cli_commands(): res = RiftExpectSession("2n_l0_l1") check_show_fsm_lie(res) check_show_fsm_ztp(res) check_show_interface(res) check_show_interface_fsm_history(res) check_show_interface_fsm_verbose_history(res) check_show_interfaces(res) check_show_node(res) check_show_node_fsm_history(res) check_show_node_fsm_verbose_history(res) check_show_nodes(res) check_show_nodes_level(res) check_set_level(res) check_set_node(res) res.stop()
def test_cli_commands(): res = RiftExpectSession("2n_l0_l1") check_clear_engine_statistics(res) check_clear_interface_statistics(res) check_clear_node_statistics(res) check_set_interface_failure(res) check_set_level(res) check_set_node(res) check_show_engine(res) check_show_engine_statistics(res) check_show_flooding_reduction(res) check_show_forwarding(res) check_show_forwarding_prefix(res) check_show_fsm_lie(res) check_show_fsm_ztp(res) check_show_interface(res) check_show_interface_fsm_history(res) check_show_interface_fsm_verbose_history(res) check_show_interface_queues(res) check_show_interface_sockets(res) check_show_interface_statistics(res) check_show_interface_statistics_exclude_zero(res) check_show_interfaces(res) check_show_kernel_addresses(res) check_show_kernel_links(res) check_show_kernel_routes(res) check_show_kernel_routes_table(res) check_show_kernel_routes_table_prefix(res) check_show_node(res) check_show_node_fsm_history(res) check_show_node_fsm_verbose_history(res) check_show_node_statistics(res) check_show_node_statistics_exclude_zero(res) check_show_nodes(res) check_show_nodes_level(res) check_show_routes(res) check_show_routes_prefix(res) check_show_routes_prefix_owner(res) check_show_spf(res) check_show_spf_direction(res) check_show_spf_direction_destination(res) check_set_level(res) check_set_node(res) check_stop(res) res.stop()
def test__large__neg_disagg(): # __large__ means: don't run this test in a constrained environment (e.g. a small laptop) # Disable debug logging for large topologies such as multiple (it makes convergence too slow) res = RiftExpectSession("multiplane", start_converge_secs=45.0, reconverge_secs=20.0, log_debug=False) # E-W neighbors should not be present in south SPF check_ew_absence_in_south_spf(res) # E-W neighbors must be present in special SPF check_ew_in_special_spf(res) # Break spine_1_1_1 interfaces connected to tof_1_2_1 (so a next hop should be removed from SPF) res.interface_failure(node="spine_1_1_1", interface="if2", failure="failed") # Check that spines lost a positive next hop for the negative disaggregated prefixes check_spine_positive_next_hops(res) # Break last spine_1_1_1 interface to reach a fallen leaf situation with first ToF plane res.interface_failure(node="spine_1_1_1", interface="if3", failure="failed") # Check that leaf_1_0_1 and leaf_1_0_2 are not reachable with south SPF of tof_1_1_1 and # tof_1_2_2 check_fall_leafs_s_spf(res) # Check that leaf_1_0_1 and leaf_1_0_2 are reachable using special SPF of tof_1_1_1 and # tof_1_2_2 check_fall_leafs_sp_spf(res) # Check that each spine loses all the positive next hops for the negative disaggregated prefixes # and computes only negative next hops check_spine_negative_disagg_spf(res) # Check that each leaf computed a negative next hops for the negative disaggregated prefixes check_leaf_negative_next_hops(res) # Both ToFs of plane 1 should store neg disagg TIE check_neg_tie_in_tof(res) # Spines should store the neg disagg TIE check_neg_tie_in_spines(res) # Neg disagg TIE should be also propagated from spine to leafs check_neg_tie_in_leafs(res) res.stop()
def test_3n_l0_l1_l2(): passive_nodes = os.getenv("RIFT_PASSIVE_NODES", "").split(",") # Bring topology up les = LogExpectSession() res = RiftExpectSession("3n_l0_l1_l2") # Check that node1-node2 and node2-node3 adjacencies reaches 3-way if "node1" not in passive_nodes: check_rift_node1_intf_up(res) check_log_node1_intf_up(les) if "node2" not in passive_nodes: check_rift_node2_intf_up(res) check_log_node2_intf_up(les) if "node3" not in passive_nodes: check_rift_node3_intf_up(res) check_log_node3_intf_up(les) if "node1" not in passive_nodes: # Bring interface if1 on node1 down res.interface_failure("node1", "if1", "failed") check_rift_node1_intf_down(res) check_log_node1_intf_down(res) if "node2" not in passive_nodes: check_rift_node2_intf_down(res) check_log_node2_intf_down(res) if "node3" not in passive_nodes: check_rift_node3_intf_down(res) check_log_node3_intf_down(res) # TODO: add test cases for bringing interface node2-node3 down # Done res.stop()
def test_neg_disagg_ties(): # Disable debug logging for large topologies such as multiple (it makes convergence too slow) res = RiftExpectSession("multiplane", start_converge_secs=45.0, reconverge_secs=20.0, log_debug=False) # Break spine_1_1_1 interfaces connected to ToFs to reach a fallen leaf situation res.interface_failure(node="spine_1_1_1", interface="if2", failure="failed") res.interface_failure(node="spine_1_1_1", interface="if3", failure="failed") # Both ToFs of plane 1 should store neg disagg TIE check_neg_tie_in_tof(res) # Spines should store the neg disagg TIE check_neg_tie_in_spines(res) # Neg disagg TIE should be also propagated from spine to leafs check_neg_tie_in_leafs(res) res.stop()
def test_2n_l0_l1(): passive_nodes = os.getenv("RIFT_PASSIVE_NODES", "").split(",") # Bring topology up les = LogExpectSession() res = RiftExpectSession("2n_l0_l1") # Check that adjacency reaches 3-way, check offers, check levels if "node1" not in passive_nodes: check_rift_node1_intf_up(res) check_log_node1_intf_up(les) if "node2" not in passive_nodes: check_rift_node2_intf_up(res) check_log_node2_intf_up(les) if "node1" not in passive_nodes: # Bring interface if1 on node1 down res.interface_failure("node1", "if1", "failed") # Check that adjacency goes back to 1-way, check offers, check levels check_rift_node1_intf_down(res) check_log_node1_intf_down(les) if "node2" not in passive_nodes: check_rift_node2_intf_down(res) check_log_node2_intf_down(les) # Done res.stop()
def test_standalone(): res = RiftExpectSession() check_show_node(res) check_show_nodes(res) res.stop()