Skip to content

Commit

Permalink
orchagent: Adding VLAN_PREFIX macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuotian Cheng committed Jun 22, 2016
1 parent 6b10f95 commit 45140ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/swss-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ For example (reorder output)
###VLAN_TABLE
;Defines VLANs and the interfaces which are members of the vlan
;Status: work in progress
key = VLAN_TABLE:"vlan"vlanid ; DIGIT 0-4095 with prefix "vlan"
key = VLAN_TABLE:"vlan"vlanid ; DIGIT 0-4095 with prefix "Vlan"
admin_status = "down" / "up" ; admin status
oper_status = "down" / "up" ; operating status
mtu = 1*4DIGIT ; MTU for the IP interface of the VLAN
Expand Down
8 changes: 5 additions & 3 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ extern sai_vlan_api_t *sai_vlan_api;
extern sai_lag_api_t *sai_lag_api;
extern sai_hostif_api_t* sai_hostif_api;

#define VLAN_PREFIX "Vlan"

PortsOrch::PortsOrch(DBConnector *db, vector<string> tableNames) :
Orch(db, tableNames)
{
Expand Down Expand Up @@ -300,8 +302,8 @@ void PortsOrch::doVlanTask(Consumer &consumer)

string key = kfvKey(t);

/* Assert the key starts with "vlan" */
assert(!strncmp(key.c_str(), "vlan", 4));
/* Assert the key starts with "Vlan" */
assert(!strncmp(key.c_str(), VLAN_PREFIX, 4));

key = key.substr(4);
size_t found = key.find(':');
Expand All @@ -315,7 +317,7 @@ void PortsOrch::doVlanTask(Consumer &consumer)
port_alias = key.substr(found+1);
}

vlan_alias = "vlan" + to_string(vlan_id);
vlan_alias = VLAN_PREFIX + to_string(vlan_id);
string op = kfvOp(t);

/* Manipulate VLAN when port_alias is empty */
Expand Down

0 comments on commit 45140ae

Please sign in to comment.