-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OrchAgent add more logging #12
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,8 @@ const char *test_profile_get_value ( | |
_In_ sai_switch_profile_id_t profile_id, | ||
_In_ const char *variable) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
auto it = gProfileMap.find(variable); | ||
|
||
if (it == gProfileMap.end()) | ||
|
@@ -52,6 +54,8 @@ int test_profile_get_next_value ( | |
_Out_ const char **variable, | ||
_Out_ const char **value) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. short function. no need to add this. |
||
return -1; | ||
} | ||
|
||
|
@@ -65,6 +69,8 @@ sai_switch_notification_t switch_notifications = { | |
|
||
void initSaiApi() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_api_initialize(0, (service_method_table_t *)&test_services); | ||
|
||
sai_api_query(SAI_API_SWITCH, (void **)&sai_switch_api); | ||
|
@@ -92,6 +98,8 @@ void initSaiApi() | |
|
||
void initDiagShell() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it goes into while true in another thread. no need to have it here. |
||
sai_status_t status; | ||
|
||
while (true) | ||
|
@@ -111,6 +119,10 @@ void initDiagShell() | |
|
||
int main(int argc, char **argv) | ||
{ | ||
swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); | ||
|
||
SWSS_LOG_ENTER(); | ||
|
||
int opt; | ||
sai_status_t status; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ extern MacAddress gMacAddress; | |
PortsOrch::PortsOrch(DBConnector *db, string tableName) : | ||
Orch(db, tableName) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
int i, j; | ||
sai_status_t status; | ||
sai_attribute_t attr; | ||
|
@@ -128,6 +130,8 @@ PortsOrch::PortsOrch(DBConnector *db, string tableName) : | |
|
||
bool PortsOrch::getPort(string alias, Port &p) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need here as the function returns bool and if it is false it always prints out error messages. |
||
if (m_portList.find(alias) == m_portList.end()) | ||
return false; | ||
p = m_portList[alias]; | ||
|
@@ -136,6 +140,8 @@ bool PortsOrch::getPort(string alias, Port &p) | |
|
||
bool PortsOrch::setPortAdminStatus(sai_object_id_t id, bool up) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_attribute_t attr; | ||
attr.id = SAI_PORT_ATTR_ADMIN_STATE; | ||
attr.value.booldata = up; | ||
|
@@ -151,6 +157,8 @@ bool PortsOrch::setPortAdminStatus(sai_object_id_t id, bool up) | |
|
||
void PortsOrch::doTask() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (m_toSync.empty()) | ||
return; | ||
|
||
|
@@ -249,6 +257,8 @@ void PortsOrch::doTask() | |
|
||
bool PortsOrch::initializePort(Port &p) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
SWSS_LOG_NOTICE("Initializing port alias:%s pid:%llx\n", p.m_alias.c_str(), p.m_port_id); | ||
|
||
p.m_vlan_id = FRONT_PANEL_PORT_VLAN_BASE + p.m_index; | ||
|
@@ -294,6 +304,8 @@ bool PortsOrch::initializePort(Port &p) | |
|
||
bool PortsOrch::setupVlan(sai_vlan_id_t vlan_id, sai_object_id_t port_id, sai_object_id_t &vlan_member_id) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_status_t status; | ||
|
||
status = sai_vlan_api->create_vlan(vlan_id); | ||
|
@@ -336,6 +348,8 @@ bool PortsOrch::setupVlan(sai_vlan_id_t vlan_id, sai_object_id_t port_id, sai_ob | |
bool PortsOrch::setupRouterIntfs(sai_object_id_t virtual_router_id, MacAddress mac_address, | ||
sai_vlan_id_t vlan_id, sai_object_id_t &router_intfs_id) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_attribute_t attr; | ||
vector<sai_attribute_t> attrs; | ||
|
||
|
@@ -367,6 +381,8 @@ bool PortsOrch::setupRouterIntfs(sai_object_id_t virtual_router_id, MacAddress m | |
|
||
bool PortsOrch::setupHostIntfs(sai_object_id_t id, string alias, sai_object_id_t &host_intfs_id) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_attribute_t attr; | ||
vector<sai_attribute_t> attrs; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ extern sai_object_id_t gVirtualRouterId; | |
|
||
void RouteOrch::doTask() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (m_toSync.empty()) | ||
return; | ||
|
||
|
@@ -129,12 +131,16 @@ void RouteOrch::doTask() | |
|
||
bool RouteOrch::createNextHopEntry(IpAddress ipAddress, sai_object_id_t nextHopId) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
IpAddresses ip_addresses(ipAddress.to_string()); | ||
return createNextHopEntry(ip_addresses, nextHopId); | ||
} | ||
|
||
bool RouteOrch::createNextHopEntry(IpAddresses ipAddresses, sai_object_id_t nextHopGroupId) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (m_syncdNextHops.find(ipAddresses) != m_syncdNextHops.end()) | ||
{ | ||
SWSS_LOG_ERROR("Failed to create existed next hop entry ip:%s nhid:%llx\n", ipAddresses.to_string().c_str(), nextHopGroupId); | ||
|
@@ -150,6 +156,8 @@ bool RouteOrch::createNextHopEntry(IpAddresses ipAddresses, sai_object_id_t next | |
|
||
bool RouteOrch::removeNextHopEntry(IpAddress ipAddress) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
IpAddresses ip_addresses(ipAddress.to_string()); | ||
|
||
if (m_syncdNextHops.find(ip_addresses) == m_syncdNextHops.end()) | ||
|
@@ -170,6 +178,8 @@ bool RouteOrch::removeNextHopEntry(IpAddress ipAddress) | |
|
||
bool RouteOrch::removeNextHopEntry(IpAddresses ipAddresses) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (m_syncdNextHops.find(ipAddresses) == m_syncdNextHops.end()) | ||
{ | ||
SWSS_LOG_ERROR("Failed to remove absent next hop entry ip:%s\n", ipAddresses.to_string().c_str()); | ||
|
@@ -203,28 +213,38 @@ bool RouteOrch::removeNextHopEntry(IpAddresses ipAddresses) | |
|
||
int RouteOrch::getNextHopRefCount(IpAddress ipAddress) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed for these get functions. |
||
IpAddresses ip_addresses(ipAddress.to_string()); | ||
return getNextHopRefCount(ip_addresses); | ||
} | ||
|
||
int RouteOrch::getNextHopRefCount(IpAddresses ipAddresses) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed for these get functions. |
||
return m_syncdNextHops[ipAddresses].ref_count; | ||
} | ||
|
||
NextHopEntry RouteOrch::getNextHopEntry(IpAddress ipAddress) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed for these get functions. |
||
IpAddresses ip_addresses(ipAddress.to_string()); | ||
return getNextHopEntry(ip_addresses); | ||
} | ||
|
||
NextHopEntry RouteOrch::getNextHopEntry(IpAddresses ipAddresses) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed for these get functions. |
||
return m_syncdNextHops[ipAddresses]; | ||
} | ||
|
||
bool RouteOrch::addRoute(IpPrefix ipPrefix, IpAddresses nextHops) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
/* nhid indicates the next hop id or next hop group id of this route */ | ||
sai_object_id_t next_hop_id; | ||
auto it_route = m_syncdRoutes.find(ipPrefix); | ||
|
@@ -403,6 +423,8 @@ bool RouteOrch::addRoute(IpPrefix ipPrefix, IpAddresses nextHops) | |
|
||
bool RouteOrch::removeRoute(IpPrefix ipPrefix) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_unicast_route_entry_t route_entry; | ||
route_entry.vr_id = gVirtualRouterId; | ||
route_entry.destination.addr_family = SAI_IP_ADDR_FAMILY_IPV4; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
short function. no need to add this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to know which values sai library is reading.