本文整理汇总了C++中TrexStatelessPort::get_properties方法的典型用法代码示例。如果您正苦于以下问题:C++ TrexStatelessPort::get_properties方法的具体用法?C++ TrexStatelessPort::get_properties怎么用?C++ TrexStatelessPort::get_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrexStatelessPort
的用法示例。
在下文中一共展示了TrexStatelessPort::get_properties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
/**
* get system info
*
*/
trex_rpc_cmd_rc_e
TrexRpcCmdGetSysInfo::_run(const Json::Value ¶ms, Json::Value &result) {
string hostname;
TrexStateless * main = get_stateless_obj();
Json::Value §ion = result["result"];
get_hostname(hostname);
section["hostname"] = hostname;
section["uptime"] = TrexRpcServer::get_server_uptime();
/* FIXME: core count */
section["dp_core_count"] = main->get_dp_core_count();
section["core_type"] = get_cpu_model();
/* ports */
section["port_count"] = main->get_port_count();
section["ports"] = Json::arrayValue;
for (int i = 0; i < main->get_port_count(); i++) {
string driver;
TrexPlatformApi::driver_speed_e speed;
TrexStatelessPort *port = main->get_port_by_id(i);
port->get_properties(driver, speed);
section["ports"][i]["index"] = i;
section["ports"][i]["driver"] = driver;
switch (speed) {
case TrexPlatformApi::SPEED_1G:
section["ports"][i]["speed"] = 1;
break;
case TrexPlatformApi::SPEED_10G:
section["ports"][i]["speed"] = 10;
break;
case TrexPlatformApi::SPEED_40G:
section["ports"][i]["speed"] = 40;
break;
default:
/* unknown value */
section["ports"][i]["speed"] = 0;
break;
}
}
return (TREX_RPC_CMD_OK);
}
示例2: return
/**
* get system info
*
*/
trex_rpc_cmd_rc_e
TrexRpcCmdGetSysInfo::_run(const Json::Value ¶ms, Json::Value &result) {
string hostname;
TrexStateless * main = get_stateless_obj();
Json::Value §ion = result["result"];
get_hostname(hostname);
section["hostname"] = hostname;
section["uptime"] = TrexRpcServer::get_server_uptime();
/* FIXME: core count */
section["dp_core_count"] = main->get_dp_core_count();
section["dp_core_count_per_port"] = main->get_dp_core_count() / (main->get_port_count() / 2);
section["core_type"] = get_cpu_model();
/* ports */
section["port_count"] = main->get_port_count();
section["ports"] = Json::arrayValue;
for (int i = 0; i < main->get_port_count(); i++) {
string driver;
string pci_addr;
string description;
supp_speeds_t supp_speeds;
int numa;
TrexStatelessPort *port = main->get_port_by_id(i);
port->get_properties(driver);
port->get_pci_info(pci_addr, numa);
main->get_platform_api()->getPortAttrObj(i)->get_description(description);
main->get_platform_api()->getPortAttrObj(i)->get_supported_speeds(supp_speeds);
section["ports"][i]["index"] = i;
section["ports"][i]["driver"] = driver;
section["ports"][i]["description"] = description;
section["ports"][i]["pci_addr"] = pci_addr;
section["ports"][i]["numa"] = numa;
uint16_t caps = port->get_rx_caps();
section["ports"][i]["rx"]["caps"] = Json::arrayValue;
if (caps & TrexPlatformApi::IF_STAT_IPV4_ID) {
section["ports"][i]["rx"]["caps"].append("flow_stats");
}
if (caps & TrexPlatformApi::IF_STAT_PAYLOAD) {
section["ports"][i]["rx"]["caps"].append("latency");
}
if (caps & TrexPlatformApi::IF_STAT_RX_BYTES_COUNT) {
section["ports"][i]["rx"]["caps"].append("rx_bytes");
}
section["ports"][i]["rx"]["counters"] = port->get_rx_count_num();
section["ports"][i]["is_fc_supported"] = get_stateless_obj()->get_platform_api()->getPortAttrObj(i)->is_fc_change_supported();
section["ports"][i]["is_led_supported"] = get_stateless_obj()->get_platform_api()->getPortAttrObj(i)->is_led_change_supported();
section["ports"][i]["is_link_supported"] = get_stateless_obj()->get_platform_api()->getPortAttrObj(i)->is_link_change_supported();
section["ports"][i]["is_virtual"] = get_stateless_obj()->get_platform_api()->getPortAttrObj(i)->is_virtual();
section["ports"][i]["supp_speeds"] = Json::arrayValue;
for (int speed_id=0; speed_id<supp_speeds.size(); speed_id++) {
section["ports"][i]["supp_speeds"].append(supp_speeds[speed_id]);
}
}
return (TREX_RPC_CMD_OK);
}