summaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent7ada106ae824c12c2f831312f2af82ecf13c77da (diff)
fix trex-130 issue
Diffstat (limited to 'src')
-rwxr-xr-xsrc/platform_cfg.cpp64
1 files changed, 31 insertions, 33 deletions
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 ) {
}
}