Skip to content

Commit

Permalink
Remove overly restrictive PRBS check
Browse files Browse the repository at this point in the history
Summary:
PRBS can be run if
1) The circuit is drained
2) Device A is drained
3) Device Z is drained

The current check only focuses on 2 (assuming you are on Device A) and stops
us from running PRBS of scenarios 1&3. Remove the check and let the caller
(looperino) before we run PRBS

Reviewed By: srikrishnagopu, harshitgulati18

Differential Revision: D62768015

fbshipit-source-id: 94bcf088f8ed31d9e86f4a8680d1f3cae1a43780
  • Loading branch information
Jasmeet Bagga authored and facebook-github-bot committed Sep 17, 2024
1 parent 9e588f3 commit 9bbe9d9
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 158 deletions.
282 changes: 141 additions & 141 deletions fboss/agent/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -705,148 +705,148 @@ cpp_library(
"facebook/ScubaRouteLogger.h",
],
exported_deps = [
"fbcode//common/fbwhoami:fb_who_am_i",
"fbcode//common/network:util",
"fbcode//common/stats:macros",
"fbcode//common/strings:uuid",
"fbcode//common/time:time",
"fbcode//common/time:time_core",
"fbcode//configerator/distribution/api:api",
"fbcode//fb303:service_data",
"fbcode//fb303:thread_cached_service_data",
"fbcode//fb303/detail:quantile_stat_wrappers",
"fbcode//fboss/agent:address_utils",
"fbcode//fboss/agent:agent_dir_util",
"fbcode//fboss/agent:agent_features",
"fbcode//fboss/agent:agent_fsdb_sync_manager",
"fbcode//fboss/agent:agent_stats-cpp2-types",
"fbcode//fboss/agent:asic_utils",
"fbcode//fboss/agent:constants",
"fbcode//fboss/agent:dhcpv4_options_of_interest",
"fbcode//fboss/agent:fboss-error",
"fbcode//fboss/agent:fboss-event-base",
"fbcode//fboss/agent:fboss-types",
"fbcode//fboss/agent:hw_switch_handler",
"fbcode//fboss/agent:hwswitchcallback",
"fbcode//fboss/agent:l2learn_event_observer",
"fbcode//fboss/agent:load_agent_config",
"fbcode//fboss/agent:loadbalancer_utils",
"fbcode//fboss/agent:mka_service_ports",
"fbcode//fboss/agent:monolithic_hw_switch_handler",
"fbcode//fboss/agent:packet",
"fbcode//fboss/agent:packet_observer",
"fbcode//fboss/agent:phy_snapshot_lib",
"fbcode//fboss/agent:restart_time_tracker",
"fbcode//fboss/agent:route_update_wrapper",
"fbcode//fboss/agent:state_observer",
"fbcode//fboss/agent:stats",
"fbcode//fboss/agent:sw_switch_warmboot_helper",
"fbcode//fboss/agent:switch_config-cpp2-types",
"fbcode//fboss/agent:switch_reachability-cpp2-types",
"fbcode//fboss/agent:switch_state-cpp2-types",
"fbcode//fboss/agent:switchid_scope_resolver",
"fbcode//fboss/agent:switchinfo_utils",
"fbcode//fboss/agent:utils",
"fbcode//fboss/agent/capture:capture",
"fbcode//fboss/agent/hw:hw_cpu_fb303_stats",
"fbcode//fboss/agent/hw:hw_switch_fb303_stats",
"fbcode//fboss/agent/hw:hw_switch_warmboot_helper",
"fbcode//fboss/agent/hw/switch_asics:switch_asics",
"fbcode//fboss/agent/if:ctrl-cpp2-services",
"fbcode//fboss/agent/if:ctrl-cpp2-types",
"fbcode//fboss/agent/if:hw_ctrl-cpp2-services",
"fbcode//fboss/agent/if:mpls-cpp2-types",
"fbcode//fboss/agent/if:multiswitch_ctrl-cpp2-services",
"fbcode//fboss/agent/lldp:lldp",
"fbcode//fboss/agent/packet:ether_type",
"fbcode//fboss/agent/packet:ipproto",
"fbcode//fboss/agent/packet:packet",
"fbcode//fboss/agent/packet:packet_factory",
"fbcode//fboss/agent/packet:pktutil",
"fbcode//fboss/agent/platforms/common:platform_mapping",
"fbcode//fboss/agent/platforms/common:platform_mapping_utils",
"fbcode//fboss/agent/platforms/common/janga800bic:janga800bic_platform_mapping",
"fbcode//fboss/agent/platforms/common/meru400bfu:meru400bfu_platform_mapping",
"fbcode//fboss/agent/platforms/common/meru400bia:meru400bia_platform_mapping",
"fbcode//fboss/agent/platforms/common/meru400biu:meru400biu_platform_mapping",
"fbcode//fboss/agent/platforms/common/meru800bfa:meru800bfa_platform_mapping",
"fbcode//fboss/agent/platforms/common/meru800bia:meru800bia_platform_mapping",
"fbcode//fboss/agent/rib:fib_updater",
"fbcode//fboss/agent/rib:network_to_route_map",
"fbcode//fboss/agent/rib:standalone_rib",
"fbcode//fboss/agent/state:nodebase",
"fbcode//fboss/agent/state:state",
"fbcode//fboss/agent/state:state_update",
"fbcode//fboss/agent/state:state_utils",
"fbcode//fboss/agent/thrift_packet_stream:bidirectional_packet_stream",
"fbcode//fboss/facebook/bitsflow:bitsflow_helper",
"fbcode//fboss/fsdb/client:fsdb_pub_sub",
"fbcode//fboss/fsdb/client:fsdb_stream_client",
"fbcode//fboss/fsdb/client:fsdb_sub_manager",
"fbcode//fboss/fsdb/common:flags",
"fbcode//fboss/fsdb/if:fsdb_common-cpp2-types",
"fbcode//fboss/fsdb/if:fsdb_model",
"fbcode//fboss/fsdb/if:fsdb_oper-cpp2-types",
"fbcode//fboss/lib:alert_logger",
"fbcode//fboss/lib:common_file_utils",
"fbcode//fboss/lib:common_utils",
"fbcode//fboss/lib:exponential_back_off",
"fbcode//fboss/lib:hw_write_behavior",
"fbcode//fboss/lib:radix_tree",
"fbcode//fboss/lib:thread_heartbeat",
"fbcode//fboss/lib/config:fboss_config_utils",
"fbcode//fboss/lib/phy:phy-cpp2-types",
"fbcode//fboss/lib/phy:prbs-cpp2-types",
"fbcode//fboss/lib/platforms:product-info",
"fbcode//fboss/thrift_cow/nodes:nodes",
"fbcode//fboss/thrift_cow/nodes:serializer",
"fbcode//fboss/thrift_cow/storage:cow_storage",
"fbcode//fboss/util:logging",
"fbcode//folly:conv",
"fbcode//folly:demangle",
"fbcode//folly:exception_string",
"fbcode//folly:file_util",
"fbcode//folly:format",
"fbcode//folly:glog",
"fbcode//folly:intrusive_list",
"fbcode//folly:map_util",
"fbcode//folly:memory",
"fbcode//folly:network_address",
"fbcode//folly:random",
"fbcode//folly:range",
"fbcode//folly:shared_mutex",
"fbcode//folly:spin_lock",
"fbcode//folly:string",
"fbcode//folly:synchronized",
"fbcode//folly:thread_local",
"fbcode//folly:utility",
"fbcode//folly/concurrency:concurrent_hash_map",
"fbcode//folly/container:f14_hash",
"fbcode//folly/executors:io_thread_pool_executor",
"fbcode//folly/executors/thread_factory:named_thread_factory",
"fbcode//folly/futures:core",
"fbcode//folly/gen:base",
"fbcode//folly/io:iobuf",
"fbcode//folly/io/async:async_base",
"fbcode//folly/io/async:scoped_event_base_thread",
"fbcode//folly/json:dynamic",
"fbcode//folly/lang:bits",
"fbcode//folly/lang:c_string",
"fbcode//folly/logging:logging",
"fbcode//folly/system:thread_name",
"fbcode//scribe/client:scribe_client",
"fbcode//scribe/client:scribe_client_no_sr",
"fbcode//servicerouter/client/cpp2:cpp2_via_mcrouter",
"fbcode//thrift/lib/cpp/util:enum_utils",
"fbcode//thrift/lib/cpp2/async:header_client_channel",
"fbcode//thrift/lib/cpp2/async:pooled_request_channel",
"fbcode//thrift/lib/cpp2/async:reconnecting_request_channel",
"fbcode//thrift/lib/cpp2/async:request_channel",
"fbcode//thrift/lib/cpp2/async:retrying_request_channel",
"fbcode//thrift/lib/cpp2/async:rocket_client_channel",
"fbcode//thrift/lib/cpp2/protocol:protocol",
"fbcode//thrift/lib/cpp2/util:util",
"fbsource//third-party/googletest:gtest",
":address_utils",
":agent_dir_util",
":agent_features",
":agent_fsdb_sync_manager",
":agent_stats-cpp2-types",
":asic_utils",
":constants",
":dhcpv4_options_of_interest",
":fboss-error",
":fboss-event-base",
":fboss-types",
":hw_switch_handler",
":hwswitchcallback",
":l2learn_event_observer",
":load_agent_config",
":loadbalancer_utils",
":mka_service_ports",
":monolithic_hw_switch_handler",
":packet",
":packet_observer",
":phy_snapshot_lib",
":restart_time_tracker",
":route_update_wrapper",
":state_observer",
":stats",
":sw_switch_warmboot_helper",
":switch_config-cpp2-types",
":switch_reachability-cpp2-types",
":switch_state-cpp2-types",
":switchid_scope_resolver",
":switchinfo_utils",
":utils",
"//common/fbwhoami:fb_who_am_i",
"//common/network:util",
"//common/stats:macros",
"//common/strings:uuid",
"//common/time:time",
"//common/time:time_core",
"//configerator/distribution/api:api",
"//fb303:service_data",
"//fb303:thread_cached_service_data",
"//fb303/detail:quantile_stat_wrappers",
"//fboss/agent/capture:capture",
"//fboss/agent/hw:hw_cpu_fb303_stats",
"//fboss/agent/hw:hw_switch_fb303_stats",
"//fboss/agent/hw:hw_switch_warmboot_helper",
"//fboss/agent/hw/switch_asics:switch_asics",
"//fboss/agent/if:ctrl-cpp2-services",
"//fboss/agent/if:ctrl-cpp2-types",
"//fboss/agent/if:hw_ctrl-cpp2-services",
"//fboss/agent/if:mpls-cpp2-types",
"//fboss/agent/if:multiswitch_ctrl-cpp2-services",
"//fboss/agent/lldp:lldp",
"//fboss/agent/packet:ether_type",
"//fboss/agent/packet:ipproto",
"//fboss/agent/packet:packet",
"//fboss/agent/packet:packet_factory",
"//fboss/agent/packet:pktutil",
"//fboss/agent/platforms/common:platform_mapping",
"//fboss/agent/platforms/common:platform_mapping_utils",
"//fboss/agent/platforms/common/janga800bic:janga800bic_platform_mapping",
"//fboss/agent/platforms/common/meru400bfu:meru400bfu_platform_mapping",
"//fboss/agent/platforms/common/meru400bia:meru400bia_platform_mapping",
"//fboss/agent/platforms/common/meru400biu:meru400biu_platform_mapping",
"//fboss/agent/platforms/common/meru800bfa:meru800bfa_platform_mapping",
"//fboss/agent/platforms/common/meru800bia:meru800bia_platform_mapping",
"//fboss/agent/rib:fib_updater",
"//fboss/agent/rib:network_to_route_map",
"//fboss/agent/rib:standalone_rib",
"//fboss/agent/state:nodebase",
"//fboss/agent/state:state",
"//fboss/agent/state:state_update",
"//fboss/agent/state:state_utils",
"//fboss/agent/thrift_packet_stream:bidirectional_packet_stream",
"//fboss/facebook/bitsflow:bitsflow_helper",
"//fboss/fsdb/client:fsdb_pub_sub",
"//fboss/fsdb/client:fsdb_stream_client",
"//fboss/fsdb/client:fsdb_sub_manager",
"//fboss/fsdb/common:flags",
"//fboss/fsdb/if:fsdb_common-cpp2-types",
"//fboss/fsdb/if:fsdb_model",
"//fboss/fsdb/if:fsdb_oper-cpp2-types",
"//fboss/lib:alert_logger",
"//fboss/lib:common_file_utils",
"//fboss/lib:common_utils",
"//fboss/lib:exponential_back_off",
"//fboss/lib:hw_write_behavior",
"//fboss/lib:radix_tree",
"//fboss/lib:thread_heartbeat",
"//fboss/lib/config:fboss_config_utils",
"//fboss/lib/phy:phy-cpp2-types",
"//fboss/lib/phy:prbs-cpp2-types",
"//fboss/lib/platforms:product-info",
"//fboss/thrift_cow/nodes:nodes",
"//fboss/thrift_cow/nodes:serializer",
"//fboss/thrift_cow/storage:cow_storage",
"//fboss/util:logging",
"//folly:conv",
"//folly:demangle",
"//folly:exception_string",
"//folly:file_util",
"//folly:format",
"//folly:glog",
"//folly:intrusive_list",
"//folly:map_util",
"//folly:memory",
"//folly:network_address",
"//folly:random",
"//folly:range",
"//folly:shared_mutex",
"//folly:spin_lock",
"//folly:string",
"//folly:synchronized",
"//folly:thread_local",
"//folly:utility",
"//folly/concurrency:concurrent_hash_map",
"//folly/container:f14_hash",
"//folly/executors:io_thread_pool_executor",
"//folly/executors/thread_factory:named_thread_factory",
"//folly/futures:core",
"//folly/gen:base",
"//folly/io:iobuf",
"//folly/io/async:async_base",
"//folly/io/async:scoped_event_base_thread",
"//folly/json:dynamic",
"//folly/lang:bits",
"//folly/lang:c_string",
"//folly/logging:logging",
"//folly/system:thread_name",
"//scribe/client:scribe_client",
"//scribe/client:scribe_client_no_sr",
"//servicerouter/client/cpp2:cpp2",
"//thrift/lib/cpp/util:enum_utils",
"//thrift/lib/cpp2/async:header_client_channel",
"//thrift/lib/cpp2/async:pooled_request_channel",
"//thrift/lib/cpp2/async:reconnecting_request_channel",
"//thrift/lib/cpp2/async:request_channel",
"//thrift/lib/cpp2/async:retrying_request_channel",
"//thrift/lib/cpp2/async:rocket_client_channel",
"//thrift/lib/cpp2/protocol:protocol",
"//thrift/lib/cpp2/util:util",
],
exported_external_deps = [
"boost",
Expand Down
17 changes: 0 additions & 17 deletions fboss/agent/ThriftHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ DEFINE_bool(
false, // false => Prevents such mutations in prod
"Allow mutations of running switch state by external thrift calls");

DEFINE_bool(
skip_drain_check_for_prbs,
false,
"Skips drain check for local PRBS testing");

DECLARE_bool(intf_nbr_tables);

DECLARE_bool(enable_acl_table_group);
Expand Down Expand Up @@ -1598,18 +1593,6 @@ void ThriftHandler::setPortPrbs(
throw FbossError("Polynomial not supported");
}
auto switchId = sw_->getScopeResolver()->scope(portId).switchId();
auto switchType = sw_->getHwAsicTable()->getHwAsic(switchId)->getSwitchType();
// If ASIC is DNX and --skip-drain-check-for-prbs is disabled, check if
// interface or device is drained before setting interface PRBS.
if (switchType == cfg::SwitchType::VOQ ||
switchType == cfg::SwitchType::FABRIC) {
auto isDrained =
(port->getPortDrainState() == cfg::PortDrainState::DRAINED) ||
isSwitchDrained();
if (!FLAGS_skip_drain_check_for_prbs && !isDrained) {
throw FbossError("Cannot set PRBS on undrained interface");
}
}
phy::PortPrbsState newPrbsState;
*newPrbsState.enabled() = enable;
*newPrbsState.polynominal() = polynominal;
Expand Down

0 comments on commit 9bbe9d9

Please sign in to comment.