{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/sonic-swss/pulls/comments/73782354","id":73782354,"diff_hunk":"@@ -0,0 +1,479 @@\n+#include \"sai.h\"\n+#include \"tokenize.h\"\n+#include \"copporch.h\"\n+#include \"logger.h\"\n+\n+#include <sstream>\n+#include <iostream>\n+\n+using namespace swss;\n+\n+extern sai_hostif_api_t*    sai_hostif_api;\n+extern sai_policer_api_t*   sai_policer_api;\n+\n+std::map<string, sai_meter_type_t> policer_meter_map = {\n+    {\"packets\", SAI_METER_TYPE_PACKETS},\n+    {\"bytes\", SAI_METER_TYPE_BYTES}\n+};\n+\n+std::map<string, sai_policer_mode_t> policer_mode_map = {\n+    {\"sr_tcm\", SAI_POLICER_MODE_Sr_TCM},\n+    {\"tr_tcm\", SAI_POLICER_MODE_Tr_TCM},\n+    {\"storm\",  SAI_POLICER_MODE_STORM_CONTROL}\n+};\n+\n+std::map<string, sai_policer_color_source_t> policer_color_aware_map = {\n+    {\"aware\", SAI_POLICER_COLOR_SOURCE_AWARE},\n+    {\"blind\", SAI_POLICER_COLOR_SOURCE_BLIND}\n+};\n+\n+std::map<string, sai_hostif_trap_id_t> trap_id_map = {\n+    {\"stp\", SAI_HOSTIF_TRAP_ID_STP},\n+    {\"lacp\", SAI_HOSTIF_TRAP_ID_LACP},\n+    {\"eapol\", SAI_HOSTIF_TRAP_ID_EAPOL},\n+    {\"lldp\", SAI_HOSTIF_TRAP_ID_LLDP},\n+    {\"pvrst\", SAI_HOSTIF_TRAP_ID_PVRST},\n+    {\"igmp_query\", SAI_HOSTIF_TRAP_ID_IGMP_TYPE_QUERY},\n+    {\"igmp_leave\", SAI_HOSTIF_TRAP_ID_IGMP_TYPE_LEAVE},\n+    {\"igmp_v1_report\", SAI_HOSTIF_TRAP_ID_IGMP_TYPE_V1_REPORT},\n+    {\"igmp_v2_report\", SAI_HOSTIF_TRAP_ID_IGMP_TYPE_V2_REPORT},\n+    {\"igmp_v3_report\", SAI_HOSTIF_TRAP_ID_IGMP_TYPE_V3_REPORT},\n+    {\"sample_packet\", SAI_HOSTIF_TRAP_ID_SAMPLEPACKET},\n+    {\"switch_cust_range\", SAI_HOSTIF_TRAP_ID_SWITCH_CUSTOM_RANGE_BASE},\n+    {\"arp_req\", SAI_HOSTIF_TRAP_ID_ARP_REQUEST},\n+    {\"arp_resp\", SAI_HOSTIF_TRAP_ID_ARP_RESPONSE},\n+    {\"dhcp\", SAI_HOSTIF_TRAP_ID_DHCP},\n+    {\"ospf\", SAI_HOSTIF_TRAP_ID_OSPF},\n+    {\"pim\", SAI_HOSTIF_TRAP_ID_PIM},\n+    {\"vrrp\", SAI_HOSTIF_TRAP_ID_VRRP},\n+    {\"bgp\", SAI_HOSTIF_TRAP_ID_BGP},\n+    {\"dhcpv6\", SAI_HOSTIF_TRAP_ID_DHCPV6},\n+    {\"ospvfv6\", SAI_HOSTIF_TRAP_ID_OSPFV6},\n+    {\"vrrpv6\", SAI_HOSTIF_TRAP_ID_VRRPV6},\n+    {\"bgpv6\", SAI_HOSTIF_TRAP_ID_BGPV6},\n+    {\"neigh_discovery\", SAI_HOSTIF_TRAP_ID_IPV6_NEIGHBOR_DISCOVERY},\n+    {\"mld_v1_v2\", SAI_HOSTIF_TRAP_ID_IPV6_MLD_V1_V2},\n+    {\"mld_v1_report\", SAI_HOSTIF_TRAP_ID_IPV6_MLD_V1_REPORT},\n+    {\"mld_v2_done\", SAI_HOSTIF_TRAP_ID_IPV6_MLD_V1_DONE},\n+    {\"mld_v2_report\", SAI_HOSTIF_TRAP_ID_MLD_V2_REPORT},\n+    {\"ip2me\", SAI_HOSTIF_TRAP_ID_IP2ME},\n+    {\"ssh\", SAI_HOSTIF_TRAP_ID_SSH},\n+    {\"snmp\", SAI_HOSTIF_TRAP_ID_SNMP},\n+    {\"router_custom_range\", SAI_HOSTIF_TRAP_ID_ROUTER_CUSTOM_RANGE_BASE},\n+    {\"l3_mtu_error\", SAI_HOSTIF_TRAP_ID_L3_MTU_ERROR},\n+    {\"ttl\", SAI_HOSTIF_TRAP_ID_TTL_ERROR}\n+};\n+\n+std::map<string, sai_packet_action_t> packet_action_map = {\n+    {\"drop\", SAI_PACKET_ACTION_DROP},\n+    {\"forward\", SAI_PACKET_ACTION_FORWARD},\n+    {\"copy\", SAI_PACKET_ACTION_COPY},\n+    {\"copy_cancel\", SAI_PACKET_ACTION_COPY_CANCEL},\n+    {\"trap\", SAI_PACKET_ACTION_TRAP},\n+    {\"log\", SAI_PACKET_ACTION_LOG},\n+    {\"deny\", SAI_PACKET_ACTION_DENY},\n+    {\"transit\", SAI_PACKET_ACTION_TRANSIT}\n+};\n+\n+CoppOrch::CoppOrch(DBConnector *db, string tableName) :\n+    Orch(db, tableName)\n+{\n+    SWSS_LOG_ENTER();\n+};\n+\n+bool CoppOrch::getTrapID(string &trap_id_str, sai_hostif_trap_id_t &trap_id) const\n+{\n+    SWSS_LOG_ENTER();\n+    auto it = trap_id_map.find(trap_id_str);\n+    if(it == trap_id_map.end())\n+    {\n+        SWSS_LOG_ERROR(\"Invalid trap_id specified %s\\n\", trap_id_str.c_str());\n+        return false;\n+    }\n+    trap_id = trap_id_map[trap_id_str];\n+    SWSS_LOG_DEBUG(\"Output value:%d\", trap_id);\n+    return true;\n+}\n+\n+bool CoppOrch::getTrapIdList(vector<string> &trap_id_name_list, vector<sai_hostif_trap_id_t> &trap_id_list) const\n+{\n+    SWSS_LOG_ENTER();\n+    for(auto trap_id_str : trap_id_name_list)\n+    {\n+        sai_hostif_trap_id_t trap_id;\n+        if (!getTrapID(trap_id_str, trap_id))\n+        {\n+            SWSS_LOG_ERROR(\"Invalid trap_id value specified %s\\n\", trap_id_str.c_str());\n+            return false;\n+        }\n+        SWSS_LOG_DEBUG(\"Input trap_id:%s, pushing trap_id:%d\", trap_id_str.c_str(), trap_id);\n+        trap_id_list.push_back(trap_id);\n+    }\n+    return true;\n+}\n+\n+bool CoppOrch::applyTrapIds(sai_object_id_t trap_group, vector<string> &trap_id_name_list, std::vector<sai_attribute_t> &trap_id_attribs)\n+{\n+    SWSS_LOG_ENTER();\n+    sai_status_t sai_status;\n+    vector<sai_hostif_trap_id_t> trap_id_list;\n+    if (!getTrapIdList(trap_id_name_list, trap_id_list))\n+    {\n+        return false;\n+    }\n+    sai_attribute_t attr;\n+    attr.id = SAI_HOSTIF_TRAP_ATTR_TRAP_GROUP;\n+    attr.value.oid = trap_group;\n+    for (auto trap_id : trap_id_list)\n+    {\n+        SWSS_LOG_DEBUG(\"set trap attr.1:%d\", attr.id);\n+        if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->set_trap_attribute(trap_id, &attr)))\n+        {\n+            SWSS_LOG_ERROR(\"Failed to apply trap_id:%d to trap group:%llx, error:%d\\n\", trap_id, trap_group, sai_status);\n+            return false;\n+        }\n+        for(auto trap_id_attr : trap_id_attribs)\n+        {\n+            SWSS_LOG_DEBUG(\"set trap attr.2:%d\", trap_id_attr.id);\n+            if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->set_trap_attribute(trap_id, &trap_id_attr)))\n+            {\n+                SWSS_LOG_ERROR(\"Failed to apply trap_id attribute:%d to trap_id:%d, error:%d\\n\", trap_id_attr.id, trap_id, sai_status);\n+                return false;\n+            }\n+        }\n+    }\n+    return true;    \n+}\n+\n+bool CoppOrch::removePolicerFromTrapGroup(sai_object_id_t trap_group)\n+{\n+    sai_attribute_t attr;\n+    sai_status_t sai_status;\n+    sai_object_id_t policer_id;    \n+    attr.id = SAI_HOSTIF_TRAP_GROUP_ATTR_POLICER;\n+    attr.value.oid = SAI_NULL_OBJECT_ID;\n+    if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->get_trap_group_attribute(trap_group, 1, &attr))) {\n+        SWSS_LOG_ERROR(\"Failed to get policer for trap gorup:%llx, error:%d\\n\", trap_group, sai_status);\n+        return false;\n+    }\n+    policer_id = attr.value.oid;\n+    if(SAI_NULL_OBJECT_ID == policer_id)\n+    {\n+        SWSS_LOG_DEBUG(\"No policer is attached to trap gorup:%llx\\n\", trap_group);\n+        return true;\n+    }\n+\n+    attr.value.oid = SAI_NULL_OBJECT_ID;\n+    if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->set_trap_group_attribute(trap_group, &attr))) {\n+        SWSS_LOG_ERROR(\"Failed to reset policer for trap gorup:%llx, error:%d\\n\", trap_group, sai_status);\n+        return false;\n+    }\n+    if (SAI_STATUS_SUCCESS != (sai_status = sai_policer_api->remove_policer(policer_id)))\n+    {\n+        SWSS_LOG_ERROR(\"Failed to remove policer:%llx, error:%d\\n\", policer_id, sai_status);\n+        return false;\n+    }\n+    return true;\n+}\n+\n+task_process_status CoppOrch::processCoppRule(Consumer& consumer)\n+{\n+    SWSS_LOG_ENTER();\n+    sai_status_t sai_status;\n+    sai_object_id_t policer_id;\n+    vector<string> trap_id_list;\n+    string queue_ind;\n+    auto it = consumer.m_toSync.begin();\n+    KeyOpFieldsValuesTuple tuple = it->second;    \n+    string key = kfvKey(tuple);\n+    string op = kfvOp(tuple);\n+    \n+\n+    SWSS_LOG_DEBUG(\"copp:processing:%s\", key.c_str());\n+    if (consumer.m_consumer->getTableName() != APP_COPP_TABLE_NAME)\n+    {\n+        SWSS_LOG_ERROR(\"Key with invalid table type passed in %s, expected:%s\\n\", key.c_str(), APP_COPP_TABLE_NAME);\n+        return task_process_status::task_invalid_entry;\n+    }\n+    std::vector<sai_attribute_t> trap_gr_attribs;\n+    std::vector<sai_attribute_t> trap_id_attribs;\n+    std::vector<sai_attribute_t> policer_attribs;\n+    sai_attribute_t attr;\n+\n+    if (op == SET_COMMAND)\n+    {\n+        for (auto i = kfvFieldsValues(tuple).begin(); i != kfvFieldsValues(tuple).end(); i++)\n+        {\n+            SWSS_LOG_DEBUG(\"field:%s, value:%s\", fvField(*i).c_str(), fvValue(*i).c_str());\n+            sai_attribute_t attr;\n+            if (fvField(*i) == copp_trap_id_list)\n+            {\n+                trap_id_list = tokenize(fvValue(*i), list_item_delimiter);\n+            }\n+            else if (fvField(*i) == copp_queue_field)\n+            {\n+                queue_ind = fvValue(*i);\n+                SWSS_LOG_DEBUG(\"queue data:%s\", queue_ind.c_str());\n+                attr.id = SAI_HOSTIF_TRAP_GROUP_ATTR_QUEUE;\n+                attr.value.u32 = std::stoul(queue_ind);                \n+                trap_gr_attribs.push_back(attr);\n+            }\n+            //\n+            // Trap id related attributes\n+            //\n+            else if (fvField(*i) == copp_trap_action_field)\n+            {\n+                SWSS_LOG_DEBUG(\"trap action:%s\", fvValue(*i).c_str());\n+                sai_packet_action_t trap_action = packet_action_map.at(fvValue(*i));\n+                attr.id = SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION;\n+                attr.value.s32 = trap_action;\n+                trap_id_attribs.push_back(attr);\n+            }\n+            //\n+            // process policer attributes\n+            //\n+            else if (fvField(*i) == copp_policer_meter_type_field)\n+            {\n+                SWSS_LOG_DEBUG(\"policer meter:%s\", fvValue(*i).c_str());\n+                sai_meter_type_t meter_value = policer_meter_map.at(fvValue(*i));                \n+                attr.id = SAI_POLICER_ATTR_METER_TYPE;\n+                attr.value.s32 = meter_value;\n+                policer_attribs.push_back(attr);\n+            }\n+            else if (fvField(*i) == copp_policer_mode_field)\n+            {\n+                SWSS_LOG_DEBUG(\"policer mode:%s\", fvValue(*i).c_str());\n+                sai_policer_mode_t mode = policer_mode_map.at(fvValue(*i));\n+                attr.id = SAI_POLICER_ATTR_MODE;\n+                attr.value.s32 = mode;\n+                policer_attribs.push_back(attr);\n+            }        \n+            else if (fvField(*i) == copp_policer_color_field)\n+            {\n+                SWSS_LOG_DEBUG(\"policer color mode:%s\", fvValue(*i).c_str());\n+                sai_policer_color_source_t color = policer_color_aware_map.at(fvValue(*i));\n+                attr.id = SAI_POLICER_ATTR_COLOR_SOURCE;\n+                attr.value.s32 = color;\n+                policer_attribs.push_back(attr);\n+            }        \n+            else if (fvField(*i) == copp_policer_cbs_field)  \n+            {\n+                attr.id = SAI_POLICER_ATTR_CBS;\n+                attr.value.u64 = std::stoul(fvValue(*i));\n+                policer_attribs.push_back(attr);\n+                SWSS_LOG_DEBUG(\"obtained cbs:%d\", attr.value.u64);\n+            }\n+            else if (fvField(*i) == copp_policer_cir_field)          \n+            {\n+                attr.id = SAI_POLICER_ATTR_CIR;\n+                attr.value.u64 = std::stoul(fvValue(*i));\n+                policer_attribs.push_back(attr);\n+                SWSS_LOG_DEBUG(\"obtained cir:%d\", attr.value.u64);\n+            }\n+            else if (fvField(*i) == copp_policer_pbs_field)          \n+            {\n+                attr.id = SAI_POLICER_ATTR_PBS;\n+                attr.value.u64 = std::stoul(fvValue(*i));\n+                policer_attribs.push_back(attr);\n+                SWSS_LOG_DEBUG(\"obtained pbs:%d\", attr.value.u64);\n+            }\n+            else if (fvField(*i) == copp_policer_pir_field)          \n+            {\n+                attr.id = SAI_POLICER_ATTR_PIR;\n+                attr.value.u64 = std::stoul(fvValue(*i));\n+                policer_attribs.push_back(attr);\n+                SWSS_LOG_DEBUG(\"obtained pir:%d\", attr.value.u64);\n+            }\n+            else if (fvField(*i) == copp_policer_action_green_field)\n+            {\n+                SWSS_LOG_DEBUG(\"green action:%s\", queue_ind.c_str());\n+                sai_packet_action_t policer_action = packet_action_map.at(fvValue(*i));\n+                attr.id = SAI_POLICER_ATTR_GREEN_PACKET_ACTION;\n+                attr.value.s32 = policer_action;\n+                policer_attribs.push_back(attr);\n+            }\n+            else if (fvField(*i) == copp_policer_action_red_field) \n+            {\n+                SWSS_LOG_DEBUG(\"red action:%s\", queue_ind.c_str());\n+                sai_packet_action_t policer_action = packet_action_map.at(fvValue(*i));\n+                attr.id = SAI_POLICER_ATTR_RED_PACKET_ACTION;\n+                attr.value.s32 = policer_action;\n+                policer_attribs.push_back(attr);\n+            }\n+            else if (fvField(*i) == copp_policer_action_yellow_field)\n+            {\n+                SWSS_LOG_DEBUG(\"yellowaction:%s\", queue_ind.c_str());\n+                sai_packet_action_t policer_action = packet_action_map.at(fvValue(*i));\n+                attr.id = SAI_POLICER_ATTR_YELLOW_PACKET_ACTION;\n+                attr.value.s32 = policer_action;\n+                policer_attribs.push_back(attr);\n+            }\n+            else\n+            {\n+                SWSS_LOG_ERROR(\"Unknown copp field specified:%s\\n\", fvField(*i).c_str());\n+                return task_process_status::task_invalid_entry;\n+            }\n+        }\n+\n+        if (m_trap_map.find(key) != m_trap_map.end())\n+        {\n+            SWSS_LOG_DEBUG(\"found existing trap_group object:%s\", key.c_str());\n+            if(!policer_attribs.empty())\n+            {\n+                attr.id = SAI_HOSTIF_TRAP_GROUP_ATTR_POLICER;\n+                attr.value.oid = SAI_NULL_OBJECT_ID;\n+                if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->get_trap_group_attribute(m_trap_map[key], 1, &attr)))\n+                {\n+                    SWSS_LOG_ERROR(\"Failed to get policer for trap gorup:%s, error:%d\\n\", key.c_str(), sai_status);\n+                    return task_process_status::task_failed;\n+                }\n+                SWSS_LOG_DEBUG(\"Obtained policer object:%llx for trap_group:%s\", attr.value.oid, key.c_str());\n+                policer_id = attr.value.oid;                \n+                SWSS_LOG_DEBUG(\"Applying settings to existing policer:%llx for trap_group:%llx, name:%s\", policer_id, m_trap_map[key], key.c_str());\n+                if(SAI_NULL_OBJECT_ID == policer_id)\n+                {\n+                    SWSS_LOG_WARN(\"Creating policer for existing Trap group:%llx (name:%s).\", m_trap_map[key], key.c_str());\n+                    if (SAI_STATUS_SUCCESS != (sai_status = sai_policer_api->create_policer(&policer_id, policer_attribs.size(), policer_attribs.data())))\n+                    {\n+                        SWSS_LOG_ERROR(\"Failed to create policer for existing trap_group:%llx, name:%s, error:%d\", m_trap_map[key], key.c_str(), sai_status);\n+                        return task_process_status::task_failed;\n+                    }\n+                    SWSS_LOG_DEBUG(\"Created policer:%llx for existing trap group\", policer_id);\n+                }\n+                else \n+                {\n+                    for(sai_uint32_t ind = 0; ind < policer_attribs.size(); ind++)\n+                    {\n+                        auto policer_attr = policer_attribs[ind];\n+                        if (SAI_STATUS_SUCCESS != (sai_status = sai_policer_api->set_policer_attribute(policer_id, &policer_attr)))\n+                        {\n+                            SWSS_LOG_ERROR(\"Failed to apply attribute[%d].id=%d to policer for trap group:%s, error:%d\\n\", ind, policer_attr.id, key.c_str(), sai_status);\n+                            return task_process_status::task_failed;\n+                        }                    \n+                    }\n+                }\n+            }\n+            SWSS_LOG_DEBUG(\"Applying trap group attributes\");\n+            for(sai_uint32_t ind = 0; ind < trap_gr_attribs.size(); ind++)\n+            {\n+                auto trap_gr_attr = trap_gr_attribs[ind];\n+                SWSS_LOG_DEBUG(\"Applying trap group attribute:%d\", trap_gr_attr.id);\n+                if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->set_trap_group_attribute(m_trap_map[key], &trap_gr_attr)))\n+                {\n+                    SWSS_LOG_ERROR(\"Failed to apply attribute:%d to trap group:%llx, name:%s, error:%d\\n\", trap_gr_attr.id, m_trap_map[key], key.c_str(), sai_status);\n+                    return task_process_status::task_failed;\n+                }\n+            }                \n+        }\n+        else\n+        {\n+            SWSS_LOG_DEBUG(\"Creating new trap_group object:%s\", key.c_str());\n+            sai_object_id_t new_trap;\n+            if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->create_hostif_trap_group(&new_trap, trap_gr_attribs.size(), trap_gr_attribs.data())))\n+            {\n+                SWSS_LOG_ERROR(\"Failed to create new trap_group with name:%s\", key.c_str());\n+                return task_process_status::task_failed;\n+            }\n+            SWSS_LOG_DEBUG(\"Created new trap_group:%llx with name:%s\", new_trap, key.c_str());\n+            m_trap_map[key] = new_trap;\n+\n+            if(!policer_attribs.empty())\n+            {\n+                if (SAI_STATUS_SUCCESS != (sai_status = sai_policer_api->create_policer(&policer_id, policer_attribs.size(), policer_attribs.data())))\n+                {\n+                    SWSS_LOG_ERROR(\"Failed to create policer for new trap_group:%llx, name:%s, error:%d\", new_trap, key.c_str(), sai_status);\n+                    return task_process_status::task_failed;\n+                }\n+                SWSS_LOG_DEBUG(\"Created new policer:%llx\", policer_id);\n+                attr.id = SAI_HOSTIF_TRAP_GROUP_ATTR_POLICER;\n+                attr.value.oid = policer_id;\n+                if (SAI_STATUS_SUCCESS != (sai_status = sai_hostif_api->set_trap_group_attribute(new_trap, &attr))) {\n+                    SWSS_LOG_ERROR(\"Failed to bind policer:%llx to trap gorup:%llx, name:%s, error:%d\\n\", policer_id, new_trap, key.c_str(), sai_status);\n+                    return task_process_status::task_failed;\n+                }\n+                SWSS_LOG_DEBUG(\"Bound policer to the trap group\");\n+            }\n+        }\n+\n+        //\n+        // The channel is always the NETDEV device.\n+        //\n+        attr.id = SAI_HOSTIF_TRAP_ATTR_TRAP_CHANNEL;\n+        attr.value.s32 = SAI_HOSTIF_TRAP_CHANNEL_NETDEV;\n+        trap_id_attribs.push_back(attr);","path":"orchagent/copporch.cpp","position":403,"original_position":403,"commit_id":"cd83e3e42f792704012661ee0b15bde8f5f137a3","original_commit_id":"cd83e3e42f792704012661ee0b15bde8f5f137a3","user":{"login":"lguohan","id":2293967,"avatar_url":"https://avatars.githubusercontent.com/u/2293967?v=3","gravatar_id":"","url":"https://api.github.com/users/lguohan","html_url":"https://github.com/lguohan","followers_url":"https://api.github.com/users/lguohan/followers","following_url":"https://api.github.com/users/lguohan/following{/other_user}","gists_url":"https://api.github.com/users/lguohan/gists{/gist_id}","starred_url":"https://api.github.com/users/lguohan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lguohan/subscriptions","organizations_url":"https://api.github.com/users/lguohan/orgs","repos_url":"https://api.github.com/users/lguohan/repos","events_url":"https://api.github.com/users/lguohan/events{/privacy}","received_events_url":"https://api.github.com/users/lguohan/received_events","type":"User","site_admin":false},"body":"I feel if you first create an internal trap object, and then translate the internal trap object into sai trap object, it maybe easier to read.\r\n\r\n---\r\nIn reply to: [73782200](https://github.com/Azure/sonic-swss/pull/57#discussion_r73782200) [](ancestors = 73782200)","created_at":"2016-08-06T07:26:20Z","updated_at":"2016-08-06T07:26:20Z","html_url":"https://github.com/Azure/sonic-swss/pull/57#discussion_r73782354","pull_request_url":"https://api.github.com/repos/Azure/sonic-swss/pulls/57","_links":{"self":{"href":"https://api.github.com/repos/Azure/sonic-swss/pulls/comments/73782354"},"html":{"href":"https://github.com/Azure/sonic-swss/pull/57#discussion_r73782354"},"pull_request":{"href":"https://api.github.com/repos/Azure/sonic-swss/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/sonic-swss/pulls/57","id":80332229,"html_url":"https://github.com/Azure/sonic-swss/pull/57","diff_url":"https://github.com/Azure/sonic-swss/pull/57.diff","patch_url":"https://github.com/Azure/sonic-swss/pull/57.patch","issue_url":"https://api.github.com/repos/Azure/sonic-swss/issues/57","number":57,"state":"open","locked":false,"title":"[sonic-swss] Add support for COPP","user":{"login":"lguohan","id":2293967,"avatar_url":"https://avatars.githubusercontent.com/u/2293967?v=3","gravatar_id":"","url":"https://api.github.com/users/lguohan","html_url":"https://github.com/lguohan","followers_url":"https://api.github.com/users/lguohan/followers","following_url":"https://api.github.com/users/lguohan/following{/other_user}","gists_url":"https://api.github.com/users/lguohan/gists{/gist_id}","starred_url":"https://api.github.com/users/lguohan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lguohan/subscriptions","organizations_url":"https://api.github.com/users/lguohan/orgs","repos_url":"https://api.github.com/users/lguohan/repos","events_url":"https://api.github.com/users/lguohan/events{/privacy}","received_events_url":"https://api.github.com/users/lguohan/received_events","type":"User","site_admin":false},"body":"* Added new class CoppOrch\r\n* Added schema for COPP_TABLE\r\n\r\nSigned-off-by: hrachya@mellanox.com","created_at":"2016-08-06T06:13:34Z","updated_at":"2016-08-06T07:26:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"481f4ba1aa7e91abfc031e854c58aae84ddf2e4a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/sonic-swss/pulls/57/commits","review_comments_url":"https://api.github.com/repos/Azure/sonic-swss/pulls/57/comments","review_comment_url":"https://api.github.com/repos/Azure/sonic-swss/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/sonic-swss/issues/57/comments","statuses_url":"https://api.github.com/repos/Azure/sonic-swss/statuses/cd83e3e42f792704012661ee0b15bde8f5f137a3","head":{"label":"hrachya-mellanox:copp.07-29-16","ref":"copp.07-29-16","sha":"cd83e3e42f792704012661ee0b15bde8f5f137a3","user":{"login":"hrachya-mellanox","id":12867186,"avatar_url":"https://avatars.githubusercontent.com/u/12867186?v=3","gravatar_id":"","url":"https://api.github.com/users/hrachya-mellanox","html_url":"https://github.com/hrachya-mellanox","followers_url":"https://api.github.com/users/hrachya-mellanox/followers","following_url":"https://api.github.com/users/hrachya-mellanox/following{/other_user}","gists_url":"https://api.github.com/users/hrachya-mellanox/gists{/gist_id}","starred_url":"https://api.github.com/users/hrachya-mellanox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrachya-mellanox/subscriptions","organizations_url":"https://api.github.com/users/hrachya-mellanox/orgs","repos_url":"https://api.github.com/users/hrachya-mellanox/repos","events_url":"https://api.github.com/users/hrachya-mellanox/events{/privacy}","received_events_url":"https://api.github.com/users/hrachya-mellanox/received_events","type":"User","site_admin":false},"repo":{"id":54569590,"name":"sonic-swss","full_name":"hrachya-mellanox/sonic-swss","owner":{"login":"hrachya-mellanox","id":12867186,"avatar_url":"https://avatars.githubusercontent.com/u/12867186?v=3","gravatar_id":"","url":"https://api.github.com/users/hrachya-mellanox","html_url":"https://github.com/hrachya-mellanox","followers_url":"https://api.github.com/users/hrachya-mellanox/followers","following_url":"https://api.github.com/users/hrachya-mellanox/following{/other_user}","gists_url":"https://api.github.com/users/hrachya-mellanox/gists{/gist_id}","starred_url":"https://api.github.com/users/hrachya-mellanox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrachya-mellanox/subscriptions","organizations_url":"https://api.github.com/users/hrachya-mellanox/orgs","repos_url":"https://api.github.com/users/hrachya-mellanox/repos","events_url":"https://api.github.com/users/hrachya-mellanox/events{/privacy}","received_events_url":"https://api.github.com/users/hrachya-mellanox/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hrachya-mellanox/sonic-swss","description":"Public version of swss repository","fork":true,"url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss","forks_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/forks","keys_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/teams","hooks_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/hooks","issue_events_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/issues/events{/number}","events_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/events","assignees_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/assignees{/user}","branches_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/branches{/branch}","tags_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/tags","blobs_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/git/refs{/sha}","trees_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/statuses/{sha}","languages_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/languages","stargazers_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/stargazers","contributors_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/contributors","subscribers_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/subscribers","subscription_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/subscription","commits_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/commits{/sha}","git_commits_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/git/commits{/sha}","comments_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/comments{/number}","issue_comment_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/issues/comments{/number}","contents_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/contents/{+path}","compare_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/merges","archive_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/downloads","issues_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/issues{/number}","pulls_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/pulls{/number}","milestones_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/milestones{/number}","notifications_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/labels{/name}","releases_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/releases{/id}","deployments_url":"https://api.github.com/repos/hrachya-mellanox/sonic-swss/deployments","created_at":"2016-03-23T15:08:22Z","updated_at":"2016-03-23T15:08:24Z","pushed_at":"2016-08-05T20:33:39Z","git_url":"git://github.com/hrachya-mellanox/sonic-swss.git","ssh_url":"git@github.com:hrachya-mellanox/sonic-swss.git","clone_url":"https://github.com/hrachya-mellanox/sonic-swss.git","svn_url":"https://github.com/hrachya-mellanox/sonic-swss","homepage":null,"size":601,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Azure:master","ref":"master","sha":"2c92bc871adecf6bf751ed85032793d8f5aa03b8","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":53515475,"name":"sonic-swss","full_name":"Azure/sonic-swss","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/sonic-swss","description":"SONiC Switch State Service (SWSS)","fork":false,"url":"https://api.github.com/repos/Azure/sonic-swss","forks_url":"https://api.github.com/repos/Azure/sonic-swss/forks","keys_url":"https://api.github.com/repos/Azure/sonic-swss/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/sonic-swss/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/sonic-swss/teams","hooks_url":"https://api.github.com/repos/Azure/sonic-swss/hooks","issue_events_url":"https://api.github.com/repos/Azure/sonic-swss/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/sonic-swss/events","assignees_url":"https://api.github.com/repos/Azure/sonic-swss/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/sonic-swss/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/sonic-swss/tags","blobs_url":"https://api.github.com/repos/Azure/sonic-swss/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/sonic-swss/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/sonic-swss/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/sonic-swss/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/sonic-swss/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/sonic-swss/languages","stargazers_url":"https://api.github.com/repos/Azure/sonic-swss/stargazers","contributors_url":"https://api.github.com/repos/Azure/sonic-swss/contributors","subscribers_url":"https://api.github.com/repos/Azure/sonic-swss/subscribers","subscription_url":"https://api.github.com/repos/Azure/sonic-swss/subscription","commits_url":"https://api.github.com/repos/Azure/sonic-swss/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/sonic-swss/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/sonic-swss/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/sonic-swss/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/sonic-swss/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/sonic-swss/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/sonic-swss/merges","archive_url":"https://api.github.com/repos/Azure/sonic-swss/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/sonic-swss/downloads","issues_url":"https://api.github.com/repos/Azure/sonic-swss/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/sonic-swss/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/sonic-swss/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/sonic-swss/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/sonic-swss/labels{/name}","releases_url":"https://api.github.com/repos/Azure/sonic-swss/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/sonic-swss/deployments","created_at":"2016-03-09T17:01:09Z","updated_at":"2016-07-28T19:34:32Z","pushed_at":"2016-08-06T06:13:34Z","git_url":"git://github.com/Azure/sonic-swss.git","ssh_url":"git@github.com:Azure/sonic-swss.git","clone_url":"https://github.com/Azure/sonic-swss.git","svn_url":"https://github.com/Azure/sonic-swss","homepage":"https://azure.github.io/SONiC","size":956,"stargazers_count":17,"watchers_count":17,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":6,"forks":11,"open_issues":6,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/sonic-swss/pulls/57"},"html":{"href":"https://github.com/Azure/sonic-swss/pull/57"},"issue":{"href":"https://api.github.com/repos/Azure/sonic-swss/issues/57"},"comments":{"href":"https://api.github.com/repos/Azure/sonic-swss/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/sonic-swss/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/sonic-swss/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/sonic-swss/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/sonic-swss/statuses/cd83e3e42f792704012661ee0b15bde8f5f137a3"}}}}
{"actor":{"display_login":"lguohan"}}