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-16 02:06:09 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        3674 : ConfigJsonParserBase::ConfigJsonParserBase(){
      15        3674 : }
      16             : 
      17        3674 : ConfigJsonParserBase::~ConfigJsonParserBase() {
      18        3674 : } 
      19             : 
      20           0 : void ConfigJsonParserBase::EndOfConfig() {
      21           0 :     return;
      22             : }
      23             : 
      24        1412 : std::string ConfigJsonParserBase::GetParentName(const string &left,
      25             :                                           const string &right) const {
      26             :     ParentNameMap::const_iterator it =
      27        1412 :         parent_name_map_.find(make_pair(left, right));
      28        1412 :     if (it == parent_name_map_.end())
      29           0 :         return "";
      30        1412 :     return it->second;
      31             : }
      32             : 
      33         941 : std::string ConfigJsonParserBase::GetLinkName(const string &left,
      34             :                                         const string &right) const {
      35             :     LinkNameMap::const_iterator it =
      36         941 :         link_name_map_.find(make_pair(left, right));
      37         941 :     if (it == link_name_map_.end())
      38           0 :         return "";
      39         941 :     return it->second.first;
      40             : }
      41             : 
      42         941 : bool ConfigJsonParserBase::IsLinkWithAttr(const string &left,
      43             :                                          const string &right) const {
      44             :     LinkNameMap::const_iterator it =
      45         941 :         link_name_map_.find(make_pair(left, right));
      46         941 :     if (it == link_name_map_.end())
      47           0 :         return false;
      48         941 :     return it->second.second;
      49             : }
      50             : 
      51         416 : std::string ConfigJsonParserBase::GetWrapperFieldName(const string &type_name,
      52             :                                           const string &property_name) const {
      53             :     WrapperFieldMap::const_iterator it =
      54         416 :         wrapper_field_map_.find(type_name+':'+property_name);
      55         416 :     if (it == wrapper_field_map_.end()) {
      56           0 :         return "";
      57             :     } else {
      58             :         // TODO: Fix the autogen to have _ instead of -
      59         416 :         string temp_str = it->second;
      60         416 :         std::replace(temp_str.begin(), temp_str.end(), '-', '_');
      61         416 :         return temp_str;
      62         416 :     }
      63             : }
      64             : 
      65         186 : bool ConfigJsonParserBase::IsListOrMapPropEmpty(const string &uuid_key,
      66             :       const string &lookup_key) const {
      67         186 :     return mgr_->config_db_client()->IsListOrMapPropEmpty(uuid_key, lookup_key); 
      68             : }
      69             : 

Generated by: LCOV version 1.14