@@ -123,6 +123,7 @@ bool Orch::execute(string tableName)
123
123
bool Orch::parseReference (type_map &type_maps, string &ref_in, string &type_name, string &object_name)
124
124
{
125
125
SWSS_LOG_ENTER ();
126
+
126
127
SWSS_LOG_DEBUG (" input:%s" , ref_in.c_str ());
127
128
if (ref_in.size () < 3 )
128
129
{
@@ -168,15 +169,16 @@ ref_resolve_status Orch::resolveFieldRefValue(
168
169
sai_object_id_t &sai_object)
169
170
{
170
171
SWSS_LOG_ENTER ();
171
- size_t count = 0 ;
172
+
173
+ bool hit = false ;
172
174
for (auto i = kfvFieldsValues (tuple).begin (); i != kfvFieldsValues (tuple).end (); i++)
173
175
{
174
176
if (fvField (*i) == field_name)
175
177
{
176
178
SWSS_LOG_DEBUG (" field:%s, value:%s" , fvField (*i).c_str (), fvValue (*i).c_str ());
177
- if (count > 1 )
179
+ if (hit )
178
180
{
179
- SWSS_LOG_ERROR (" Singleton field with name:%s must have only 1 instance, actual count:%d \n " , field_name.c_str (), count );
181
+ SWSS_LOG_ERROR (" Multiple same fields %s " , field_name.c_str ());
180
182
return ref_resolve_status::multiple_instances;
181
183
}
182
184
string ref_type_name, object_name;
@@ -185,12 +187,11 @@ ref_resolve_status Orch::resolveFieldRefValue(
185
187
return ref_resolve_status::not_resolved;
186
188
}
187
189
sai_object = (*(type_maps[ref_type_name]))[object_name];
188
- count++ ;
190
+ hit = true ;
189
191
}
190
192
}
191
- if (0 == count )
193
+ if (!hit )
192
194
{
193
- SWSS_LOG_NOTICE (" field with name:%s not found\n " , field_name.c_str ());
194
195
return ref_resolve_status::field_not_found;
195
196
}
196
197
return ref_resolve_status::success;
0 commit comments