def test_load_estimate_perc_line_rate(stc): perc_estimate = stak_estimation.replace("FRAMES_PER_SECOND", "PERCENT_LINE_RATE") seq_root = ET.fromstring(perc_estimate) port_tag_location_dict = { "West Port Group": ["10.14.16.27/2/7", "10.14.16.17/2/7"], "East Port Group": ["10.14.16.37/2/7", "10.14.16.47/2/8"], } # Frame size estimates, faked here frame_estimate = {"10.14.16.27/2/7": 128, "10.14.16.17/2/7": 128, "10.14.16.37/2/7": 128, "10.14.16.47/2/8": 64} # Physical information hw_dict = { "10.14.16.27/2/7": {"phy": "ETHERNET_COPPER", "speed": "SPEED_10M"}, "10.14.16.17/2/7": {"phy": "ETHERNET_COPPER", "speed": "SPEED_100M"}, "10.14.16.37/2/7": {"phy": "ETHERNET_COPPER", "speed": "SPEED_1G"}, "10.14.16.47/2/8": {"phy": "ETHERNET_COPPER", "speed": "SPEED_10G"}, } est_util = SequencerEstimator(root=seq_root) est_util.set_port_dict(port_tag_location_dict) trafficLoadEstimate = est_util.estimate_load(frame_estimate, hw_dict) # These are at 15% line rate for each port type assert trafficLoadEstimate["10.14.16.27/2/7"] == 1267 assert trafficLoadEstimate["10.14.16.17/2/7"] == 12669 assert trafficLoadEstimate["10.14.16.37/2/7"] == 126689 # This one is at 10 gigs, but at 64 byte frames assert trafficLoadEstimate["10.14.16.47/2/8"] == 2232143
def test_load_estimate_devicecount(stc): seq_root = ET.fromstring(stak_estimation) port_tag_location_dict = { "West Port Group": ["10.14.16.27/2/7", "10.14.16.17/2/7"], "East Port Group": ["10.14.16.37/2/7", "10.14.16.47/2/8"], } est_util = SequencerEstimator(root=seq_root) est_util.set_port_dict(port_tag_location_dict) trafficLoadEstimate = est_util.estimate_load() assert trafficLoadEstimate["10.14.16.27/2/7"] == 15 assert trafficLoadEstimate["10.14.16.17/2/7"] == 15 assert trafficLoadEstimate["10.14.16.37/2/7"] == 15 assert trafficLoadEstimate["10.14.16.47/2/8"] == 15
def test_no_trafficloadcfg_cmd(stc): seq_root = ET.fromstring(sequencer_xml_1 + stak_traffic + stak_end) port_tag_location_dict = { "West Port Group": ["10.14.16.27/2/7", "10.14.16.17/2/7"], "East Port Group": ["10.14.16.37/2/7", "10.14.16.47/2/8"], } est_util = SequencerEstimator(root=seq_root) est_util.set_port_dict(port_tag_location_dict) trafficLoadEstimate = est_util.estimate_load() assert trafficLoadEstimate["10.14.16.27/2/7"] == 0 assert trafficLoadEstimate["10.14.16.17/2/7"] == 0 assert trafficLoadEstimate["10.14.16.37/2/7"] == 0 assert trafficLoadEstimate["10.14.16.47/2/8"] == 0