summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-10-18 14:43:49 +0300
committerHanoh Haim <hhaim@cisco.com>2015-10-18 14:43:49 +0300
commitba9973506c1de58c87ccaa59798fb4e6252a186e (patch)
treed4d310659e7ab09cbc921d3b3410f52784f91811
parent7ada106ae824c12c2f831312f2af82ecf13c77da (diff)
fix trex-130 issue
-rwxr-xr-xscripts/cfg/cfg_example1.yaml9
-rwxr-xr-xsrc/platform_cfg.cpp64
2 files changed, 39 insertions, 34 deletions
diff --git a/scripts/cfg/cfg_example1.yaml b/scripts/cfg/cfg_example1.yaml
index bfd7fd88..224fb15e 100755
--- a/scripts/cfg/cfg_example1.yaml
+++ b/scripts/cfg/cfg_example1.yaml
@@ -6,8 +6,15 @@
enable_zmq_pub : true # enable publisher for stats data
zmq_pub_port : 4507
telnet_port : 4508 # the telnet port in case it is enable ( with intercative mode )
+ platform :
+ master_thread_id : 12
+ latency_thread_id : 13
+ dual_if :
+ - socket : 1
+ threads : [8,9,10,11]
+
port_info : # set eh mac addr
- - dest_mac : [0x1,0x0,0x0,0x1,0x0,0x00] # port 0
+ - dest_mac : [1,0x0,0x0,0x1,0x0,0x00] # port 0
src_mac : [0x2,0x0,0x0,0x2,0x0,0x00]
- dest_mac : [0x3,0x0,0x0,0x3,0x0,0x00] # port 1
src_mac : [0x4,0x0,0x0,0x4,0x0,0x00]
diff --git a/src/platform_cfg.cpp b/src/platform_cfg.cpp
index a226a9ac..db563cc9 100755
--- a/src/platform_cfg.cpp
+++ b/src/platform_cfg.cpp
@@ -262,12 +262,6 @@ void operator >> (const YAML::Node& node, CPlatformMemoryYamlInfo & plat_info) {
void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) {
- try {
- node["port_limit"] >> plat_info.m_port_limit;
- plat_info.m_port_limit_exist=true;
- } catch ( const std::exception& e ) {
- plat_info.m_port_limit=0xffffffff;
- }
try {
@@ -284,14 +278,6 @@ void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) {
}
- try {
- node["enable_zmq_pub"] >> plat_info.m_enable_zmq_pub;
- node["zmq_pub_port"] >> plat_info.m_zmq_pub_port;
- plat_info.m_enable_zmq_pub_exist = true;
- } catch ( const std::exception& e ) {
- plat_info.m_enable_zmq_pub_exist = false;
- }
-
/* must have interfaces */
const YAML::Node& interfaces = node["interfaces"];
for(unsigned i=0;i<interfaces.size();i++) {
@@ -301,31 +287,44 @@ void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) {
plat_info.m_if_list.push_back(fi);
}
- try {
- node["prefix"] >> plat_info.m_prefix;
- } catch ( const std::exception& e ) {
+
+ if ( node.FindValue("port_limit") ){
+ node["port_limit"] >> plat_info.m_port_limit;
+ plat_info.m_port_limit_exist=true;
}
- try {
- node["limit_memory"] >> plat_info.m_limit_memory;
- } catch ( const std::exception& e ) {
+
+
+ plat_info.m_enable_zmq_pub_exist = true;
+
+ if ( node.FindValue("enable_zmq_pub") ){
+ node["enable_zmq_pub"] >> plat_info.m_enable_zmq_pub;
+ plat_info.m_enable_zmq_pub_exist = true;
}
- try {
- node["c"] >> plat_info.m_thread_per_dual_if;
- } catch ( const std::exception& e ) {
+
+ if ( node.FindValue("zmq_pub_port") ){
+ node["zmq_pub_port"] >> plat_info.m_zmq_pub_port;
+ plat_info.m_enable_zmq_pub_exist = true;
}
+ if ( node.FindValue("prefix") ){
+ node["prefix"] >> plat_info.m_prefix;
+ }
+ if ( node.FindValue("limit_memory") ){
+ node["limit_memory"] >> plat_info.m_limit_memory;
+ }
- try {
- node["telnet_port"] >> plat_info.m_telnet_port;
- plat_info.m_telnet_exist=true;
- } catch ( const std::exception& e ) {
- plat_info.m_telnet_port=4501;
+ if ( node.FindValue("c") ){
+ node["c"] >> plat_info.m_thread_per_dual_if;
}
- try {
- node["port_bandwidth_gb"] >> plat_info.m_port_bandwidth_gb;
- } catch ( const std::exception& e ) {
+ if ( node.FindValue("telnet_port") ){
+ node["telnet_port"] >> plat_info.m_telnet_port;
+ plat_info.m_telnet_exist=true;
+ }
+
+ if ( node.FindValue("port_bandwidth_gb") ){
+ node["port_bandwidth_gb"] >> plat_info.m_port_bandwidth_gb;
}
if ( node.FindValue("memory") ){
@@ -337,7 +336,7 @@ void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) {
plat_info.m_platform.m_is_exists=true;
}
- try {
+ if ( node.FindValue("port_info") ) {
const YAML::Node& mac_info = node["port_info"];
for(unsigned i=0;i<mac_info.size();i++) {
CMacYamlInfo fi;
@@ -346,7 +345,6 @@ void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) {
plat_info.m_mac_info.push_back(fi);
}
plat_info.m_mac_info_exist = true;
- }catch ( const std::exception& e ) {
}
}