{"action":"created","issue":{"url":"https://api.github.com/repos/aristanetworks/EosSdk/issues/29","repository_url":"https://api.github.com/repos/aristanetworks/EosSdk","labels_url":"https://api.github.com/repos/aristanetworks/EosSdk/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/aristanetworks/EosSdk/issues/29/comments","events_url":"https://api.github.com/repos/aristanetworks/EosSdk/issues/29/events","html_url":"https://github.com/aristanetworks/EosSdk/issues/29","id":234564711,"number":29,"title":"how to get port speed","user":{"login":"hubertsokolowskintl","id":28708119,"avatar_url":"https://avatars2.githubusercontent.com/u/28708119?v=4","gravatar_id":"","url":"https://api.github.com/users/hubertsokolowskintl","html_url":"https://github.com/hubertsokolowskintl","followers_url":"https://api.github.com/users/hubertsokolowskintl/followers","following_url":"https://api.github.com/users/hubertsokolowskintl/following{/other_user}","gists_url":"https://api.github.com/users/hubertsokolowskintl/gists{/gist_id}","starred_url":"https://api.github.com/users/hubertsokolowskintl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hubertsokolowskintl/subscriptions","organizations_url":"https://api.github.com/users/hubertsokolowskintl/orgs","repos_url":"https://api.github.com/users/hubertsokolowskintl/repos","events_url":"https://api.github.com/users/hubertsokolowskintl/events{/privacy}","received_events_url":"https://api.github.com/users/hubertsokolowskintl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":26,"created_at":"2017-06-08T15:23:17Z","updated_at":"2017-08-29T08:24:39Z","closed_at":null,"body":"Hi,\r\n\r\nI am trying to read current speed of an Ethernet interface and my agent either crashes or function link_speed throws an exception. If my agent is inheriting from eth_phy_intf_handler then I get SIGABRT and the application is aborting with following error in the logs:\r\n_psmenet: eth_phy_intf.cpp:125: eos::eth_link_speed_t eos::convert(Interface::EthSpeed): Assertion `false' failed.\r\nUnix Time: 1496930889: Process 2333 died with signal 6 (SIGABRT) errno 0 code -6 (unknown)\r\nThe killer was pid 2333 (myself) with uid 0\r\nBacktrace: (most recent first)\r\n/lib/libtac.so.0(ZN13SignalHandler13signalHandlerEiP9siginfo_tPv+0x21f)[0xeeb4d75f]_\r\n\r\nIf I don't inherit from the eth_phy_intf_handler and I am only using eos::sdk to get the port speed then an exception is thrown. Is there anything wrong with that code:\r\n```\r\nuint32_t EosAgent::get_speed(const string& intf_name) {\r\n    try {\r\n        eos::sdk_scoped_lock ssl;\r\n        auto* mgr = sdk.get_eth_phy_intf_mgr();\r\n        auto intf_id = sdk.get_intf_mgr()->eos_intf_name(intf_name);\r\n        if (!sdk.get_intf_mgr()->exists(intf_id)) {\r\n            log_error(GET_LOGGER(\"network-agent\"),\r\n                      \"Eos Agent interface does not exist \" + intf_name);\r\n            return 0;\r\n        }\r\n        switch(mgr->link_speed(intf_id)) {\r\n            case eos::LINK_SPEED_10MBPS:\r\n                return 10;\r\n            case eos::LINK_SPEED_100MBPS:\r\n                return 100;\r\n            case eos::LINK_SPEED_1GBPS:\r\n                return 1000;\r\n            case eos::LINK_SPEED_10GBPS:\r\n                return 10000;\r\n            case eos::LINK_SPEED_40GBPS:\r\n                return 40000;\r\n            case eos::LINK_SPEED_100GBPS:\r\n                return 100000;\r\n            case eos::LINK_SPEED_UNKNOWN:\r\n            default:\r\n                log_error(GET_LOGGER(\"network-agent\"),\r\n                          \"Eos Agent returned unknown speed for \" + intf_name);\r\n                break;\r\n        }\r\n    }\r\n    catch(eos::no_such_interface_error &error) {\r\n        log_error(GET_LOGGER(\"network-agent\"),\r\n                  \"Eos Agent no such interface \" + intf_name);\r\n    }\r\n    catch(...) {\r\n        log_error(GET_LOGGER(\"network-agent\"),\r\n                  \"Eos Agent unknown exception when getting speed for \"\r\n                  + intf_name);\r\n    }\r\n    return 0;\r\n}\r\n```\r\nThe code inside catch(...) gets executed for each iterated Ethernet interface:\r\n_2017-06-08 15:17:35.340225169 - ERROR - network-agent - Eos Agent unknown exception when getting speed for et16_1\r\n2017-06-08 15:17:35.354120901 - ERROR - network-agent - Eos Agent unknown exception when getting speed for et33_\r\n\r\nI am using EOS 4.18.\r\n\r\nRegards,\r\nHubert\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aristanetworks/EosSdk/issues/comments/325591363","html_url":"https://github.com/aristanetworks/EosSdk/issues/29#issuecomment-325591363","issue_url":"https://api.github.com/repos/aristanetworks/EosSdk/issues/29","id":325591363,"user":{"login":"ruferp","id":8683589,"avatar_url":"https://avatars1.githubusercontent.com/u/8683589?v=4","gravatar_id":"","url":"https://api.github.com/users/ruferp","html_url":"https://github.com/ruferp","followers_url":"https://api.github.com/users/ruferp/followers","following_url":"https://api.github.com/users/ruferp/following{/other_user}","gists_url":"https://api.github.com/users/ruferp/gists{/gist_id}","starred_url":"https://api.github.com/users/ruferp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruferp/subscriptions","organizations_url":"https://api.github.com/users/ruferp/orgs","repos_url":"https://api.github.com/users/ruferp/repos","events_url":"https://api.github.com/users/ruferp/events{/privacy}","received_events_url":"https://api.github.com/users/ruferp/received_events","type":"User","site_admin":false},"created_at":"2017-08-29T08:24:39Z","updated_at":"2017-08-29T08:24:39Z","body":"About the wrong version.m4: I think the github stubs tarball might have been uploaded too early. Try the one from https://www.arista.com/en/support/software-download (or just modify the m4_define to set 1.12.3). Besides the version, the other differences are mostly white-spaces and copyright blargh."}}
{"actor":{"display_login":"ruferp"}}