LCOV - code coverage report
Current view: top level - root/contrail/src/contrail-common/config-client-mgr - config_json_parser_base.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 25 31 80.6 %
Date: 2026-11-09 02:10:49 Functions: 7 9 77.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : #include "config_json_parser_base.h"
       6             : 
       7             : #include <boost/lexical_cast.hpp>
       8             : 
       9             : #include "config_cassandra_client.h"
      10             : 
      11             : #include "base/autogen_util.h"
      12             : #include "config_client_log_types.h"
      13             : 
      14        3677 : ConfigJsonParserBase::ConfigJsonParserBase(){
      15        3677 : }
      16             : 
      17        3677 : ConfigJsonParserBase::~ConfigJsonParserBase() {
      18        3677 : } 
      19             : 
      20           0 : void ConfigJsonParserBase::EndOfConfig() {
      21           0 :     return;
      22             : }
      23             : 
      24        1632 : std::string ConfigJsonParserBase::GetParentName(const string &left,
      25             :                                           const string &right) const {
      26             :     ParentNameMap::const_iterator it =
      27        1632 :         parent_name_map_.find(make_pair(left, right));
      28        1632 :     if (it == parent_name_map_.end())
      29           0 :         return "";
      30        1632 :     return it->second;
      31             : }
      32             : 
      33        1223 : std::string ConfigJsonParserBase::GetLinkName(const string &left,
      34             :                                         const string &right) const {
      35             :     LinkNameMap::const_iterator it =
      36        1223 :         link_name_map_.find(make_pair(left, right));
      37        1224 :     if (it == link_name_map_.end())
      38           0 :         return "";
      39        1224 :     return it->second.first;
      40             : }
      41             : 
      42        1224 : bool ConfigJsonParserBase::IsLinkWithAttr(const string &left,
      43             :                                          const string &right) const {
      44             :     LinkNameMap::const_iterator it =
      45        1224 :         link_name_map_.find(make_pair(left, right));
      46        1224 :     if (it == link_name_map_.end())
      47           0 :         return false;
      48        1224 :     return it->second.second;
      49             : }
      50             : 
      51         528 : std::string ConfigJsonParserBase::GetWrapperFieldName(const string &type_name,
      52             :                                           const string &property_name) const {
      53             :     WrapperFieldMap::const_iterator it =
      54         528 :         wrapper_field_map_.find(type_name+':'+property_name);
      55         528 :     if (it == wrapper_field_map_.end()) {
      56           0 :         return "";
      57             :     } else {
      58             :         // TODO: Fix the autogen to have _ instead of -
      59         528 :         string temp_str = it->second;
      60         528 :         std::replace(temp_str.begin(), temp_str.end(), '-', '_');
      61         528 :         return temp_str;
      62         528 :     }
      63             : }
      64             : 
      65         190 : bool ConfigJsonParserBase::IsListOrMapPropEmpty(const string &uuid_key,
      66             :       const string &lookup_key) const {
      67         190 :     return mgr_->config_db_client()->IsListOrMapPropEmpty(uuid_key, lookup_key); 
      68             : }
      69             : 

Generated by: LCOV version 1.14