Skip to content

Commit 87ac574

Browse files
antonpatenkoShuotian Cheng
authored and
Shuotian Cheng
committed
portsyncd: Adding 'alias' field into PORT_TABLE (sonic-net#116)
1 parent 69b163a commit 87ac574

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

portsyncd/portsyncd.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,21 @@ void handlePortConfigFile(ProducerTable &p, string file)
154154
}
155155

156156
istringstream iss(line);
157-
string alias, lanes;
158-
iss >> alias >> lanes;
157+
string name, lanes, alias;
158+
iss >> name >> lanes >> alias;
159159

160+
/* If port has no alias, then use its' name as alias */
161+
if (alias == "") {
162+
alias = name;
163+
}
160164
FieldValueTuple lanes_attr("lanes", lanes);
161-
vector<FieldValueTuple> attrs = { lanes_attr };
162-
p.set(alias, attrs);
165+
FieldValueTuple alias_attr("alias", alias);
166+
167+
vector<FieldValueTuple> attrs;
168+
attrs.push_back(lanes_attr);
169+
attrs.push_back(alias_attr);
170+
171+
p.set(name, attrs);
163172

164173
g_portSet.insert(alias);
165174
}

0 commit comments

Comments
 (0)