Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

[multi-asic] Added Support for multi-asic for telemetry/gnmi server #77

Merged
merged 13 commits into from
Jun 14, 2021

Conversation

abdosi
Copy link
Contributor

@abdosi abdosi commented Apr 27, 2021

What I did:-
This PR handles the changes as mention in the document:
MultiasicTelemetry.docx

Summary of Changes:-

  • Enhanced sonic_db_config package for multi-asic to read different namespace redis configuration. Added unit-test for same.
  • Enhanced V2R Lookup for multi-asic by understanding namespace port belongs to
  • Enhanced gNMI Server to initiate redis connection with all namespaces
  • Enhanced gNMI Server Get and Subscribe tests for multi-namespace. Added test_utils package providing utility API's needed by test-cases. Also added multi-namespace specific json files into testdata
  • Enhance parsing of Target in gNMI Request to understand namespace if present.
  • Format the modified files using go fmt. Please ignore whitespaces diff as part of review.
  • Added new test case to verify gNMI Get on non-counter DB (eg: STATE_DB) and fixed issue in existing GET of not verifying the return value.
  • Fixed the gNMI Subscribe test issue where IntervalTimeTicker function pointer not re-assigned after test case is done.

How I Verify:

  • Manual Verification of Single and Multi-asic platforms.
  1. Non V2R Dataset. Query per asic/namespace. Result from multi-asic platform
root@str2-xxxx-acs-3:/# gnmi_get -target_addr localhost:50051 -xpath SWITCH_CAPABILITY/switch -xpath_target STATE_DB/asic3 -insecure
== getRequest:
prefix: <
  target: "STATE_DB/asic3"
>
path: <
  elem: <
    name: "SWITCH_CAPABILITY"
  >
  elem: <
    name: "switch"
  >
>
encoding: JSON_IETF

== getResponse:
notification: <
  timestamp: 1619548691457577658
  prefix: <
    target: "STATE_DB/asic3"
  >
  update: <
    path: <
      elem: <
        name: "SWITCH_CAPABILITY"
      >
      elem: <
        name: "switch"
      >
    >
    val: <
      json_ietf_val: "{\"ACL_ACTIONS|EGRESS\":\"PACKET_ACTION\",\"ACL_ACTIONS|INGRESS\":\"PACKET_ACTION,MIRROR_INGRESS_ACTION\",\"ACL_ACTION|PACKET_ACTION\":\"DROP,FORWARD\",\"MAX_NEXTHOP_GROUP_COUNT\":\"256\",\"MIRROR\":\"true\",\"MIRRORV6\":\"true\"}"
    >
  >
>
  1. V2R Dataset. Query Interface Statistics. Result from multi-asic platform
root@str2-xxxx-acs-3:/# gnmi_get -target_addr localhost:50051 -xpath COUNTERS/Ethernet220 -xpath_target COUNTERS_DB -insecure
== getRequest:
prefix: <
  target: "COUNTERS_DB"
>
path: <
  elem: <
    name: "COUNTERS"
  >
  elem: <
    name: "Ethernet220"
  >
>
encoding: JSON_IETF

== getResponse:
notification: <
  timestamp: 1619548775670855765
  prefix: <
    target: "COUNTERS_DB"
  >
  update: <
    path: <
      elem: <
        name: "COUNTERS"
      >
      elem: <
        name: "Ethernet220"
      >
    >
    val: <
      json_ietf_val: "{\"SAI_PORT_STAT_ETHER_IN_PKTS_128_TO_255_OCTETS\":\"354\",\"SAI_PORT_STAT_ETHER_RX_OVERSIZE_PKTS\":\"0\",\"SAI_PORT_STAT_ETHER_STATS_TX_NO_ERRORS\":\"1333\",\"SAI_PORT_STAT_ETHER_TX_OVERSIZE_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_BROADCAST_PKTS\":\"1\",\"SAI_PORT_STAT_IF_IN_DISCARDS\":\"0\",\"SAI_PORT_STAT_IF_IN_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_IN_MULTICAST_PKTS\":\"353\",\"SAI_PORT_STAT_IF_IN_NON_UCAST_PKTS\":\"354\",\"SAI_PORT_STAT_IF_IN_OCTETS\":\"122016\",\"SAI_PORT_STAT_IF_IN_UCAST_PKTS\":\"810\",\"SAI_PORT_STAT_IF_IN_UNKNOWN_PROTOS\":\"0\",\"SAI_PORT_STAT_IF_OUT_BROADCAST_PKTS\":\"1\",\"SAI_PORT_STAT_IF_OUT_DISCARDS\":\"0\",\"SAI_PORT_STAT_IF_OUT_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_OUT_MULTICAST_PKTS\":\"361\",\"SAI_PORT_STAT_IF_OUT_NON_UCAST_PKTS\":\"362\",\"SAI_PORT_STAT_IF_OUT_OCTETS\":\"1025148\",\"SAI_PORT_STAT_IF_OUT_QLEN\":\"0\",\"SAI_PORT_STAT_IF_OUT_UCAST_PKTS\":\"971\",\"SAI_PORT_STAT_IN_DROPPED_PKTS\":\"0\",\"SAI_PORT_STAT_IP_IN_UCAST_PKTS\":\"5\",\"SAI_PORT_STAT_OUT_DROPPED_PKTS\":\"0\",\"SAI_PORT_STAT_PAUSE_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PAUSE_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_0_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_0_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_1_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_1_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_2_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_2_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_3_ON2OFF_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_3_ON2OFF_RX_PKTS_last\":\"0\",\"SAI_PORT_STAT_PFC_3_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_3_RX_PKTS_last\":\"0\",\"SAI_PORT_STAT_PFC_3_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_4_ON2OFF_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_4_ON2OFF_RX_PKTS_last\":\"0\",\"SAI_PORT_STAT_PFC_4_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_4_RX_PKTS_last\":\"0\",\"SAI_PORT_STAT_PFC_4_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_5_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_5_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_6_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_6_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_7_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_7_TX_PKTS\":\"0\"}"
    >
  >
>
  1. All Unit-test passing . Result for GET and SUBSCRIBE with new Namespace specific test-cases also.
root@abdosi-ubuntu-vm0:/src/sonic-telemetry/gnmi_server# /usr/local/go/bin/go test -mod=vendor  -v github.com/Azure/sonic-telemetry/gnmi_server -run TestGnmiGet -count=1
=== RUN   TestGnmiGet
=== RUN   TestGnmiGet/Test_non-existing_path_Target
E0427 18:41:51.150714    9141 request_binder.go:318] Error in creating the target object: rpc error: code = InvalidArgument desc = no match found in *ocbinds.Device, for path element:"MyCounters" elem:{name:"MyCounters"}
E0427 18:41:51.151419    9141 request_binder.go:176] Error in creating the target object : rpc error: code = InvalidArgument desc = no match found in *ocbinds.Device, for path element:"MyCounters" elem:{name:"MyCounters"}
=== RUN   TestGnmiGet/Test_empty_path_target
=== RUN   TestGnmiGet/Get_valid_but_non-existing_node
=== RUN   TestGnmiGet/Get_COUNTERS_PORT_NAME_MAP
=== RUN   TestGnmiGet/get_COUNTERS:Ethernet68
=== RUN   TestGnmiGet/get_COUNTERS:Ethernet68_SAI_PORT_STAT_PFC_7_RX_PKTS
=== RUN   TestGnmiGet/get_COUNTERS:Ethernet68_Pfcwd
=== RUN   TestGnmiGet/get_COUNTERS_(use_vendor_alias):Ethernet68/1
=== RUN   TestGnmiGet/get_COUNTERS_(use_vendor_alias):Ethernet68/1_SAI_PORT_STAT_PFC_7_RX_PKTS
=== RUN   TestGnmiGet/get_COUNTERS_(use_vendor_alias):Ethernet68/1_Pfcwd
=== RUN   TestGnmiGet/get_COUNTERS:Ethernet*
=== RUN   TestGnmiGet/get_COUNTERS:Ethernet*_SAI_PORT_STAT_PFC_7_RX_PKTS
=== RUN   TestGnmiGet/get_COUNTERS:Ethernet*_Pfcwd
=== RUN   TestGnmiGet/get_State_DB_Data_for_SWITCH_CAPABILITY_switch
=== RUN   TestGnmiGet/get_osversion/build
=== RUN   TestGnmiGet/get_osversion/build_file_load_error
E0427 18:41:51.200114    9141 non_db_client.go:308] Failed to read '/etc/sonic/sonic_version.yml', Cannot access '/etc/sonic/sonic_version.yml'
=== RUN   TestGnmiGet/get_osversion/build_file_parse_error
E0427 18:41:51.200685    9141 non_db_client.go:315] Failed to parse '/etc/sonic/sonic_version.yml', yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `not a v...` into client.SonicVersionInfo
=== RUN   TestGnmiGet/get_osversion/build_different_value
--- PASS: TestGnmiGet (1.49s)
    --- PASS: TestGnmiGet/Test_non-existing_path_Target (0.02s)
  --- PASS: TestGnmiGet/Test_empty_path_target (0.00s)                                                                                                                                                             --- PASS: TestGnmiGet/Get_valid_but_non-existing_node (0.01s)
    --- PASS: TestGnmiGet/Get_COUNTERS_PORT_NAME_MAP (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS:Ethernet68 (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS:Ethernet68_SAI_PORT_STAT_PFC_7_RX_PKTS (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS:Ethernet68_Pfcwd (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS_(use_vendor_alias):Ethernet68/1 (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS_(use_vendor_alias):Ethernet68/1_SAI_PORT_STAT_PFC_7_RX_PKTS (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS_(use_vendor_alias):Ethernet68/1_Pfcwd (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS:Ethernet* (0.01s)
    --- PASS: TestGnmiGet/get_COUNTERS:Ethernet*_SAI_PORT_STAT_PFC_7_RX_PKTS (0.01s)
    --- PASS: TestGnmiGet/get_COUNTERS:Ethernet*_Pfcwd (0.01s)
    --- PASS: TestGnmiGet/get_State_DB_Data_for_SWITCH_CAPABILITY_switch (0.00s)
    --- PASS: TestGnmiGet/get_osversion/build (0.00s)
    --- PASS: TestGnmiGet/get_osversion/build_file_load_error (0.00s)
    --- PASS: TestGnmiGet/get_osversion/build_file_parse_error (0.00s)
    --- PASS: TestGnmiGet/get_osversion/build_different_value (0.00s)
=== RUN   TestGnmiGetMultiNs
=== RUN   TestGnmiGetMultiNs/Test_non-existing_path_Target
E0427 18:41:56.007094    9141 request_binder.go:318] Error in creating the target object: rpc error: code = InvalidArgument desc = no match found in *ocbinds.Device, for path element:"MyCounters" elem:{name:"$yCounters"}
E0427 18:41:56.007123    9141 request_binder.go:176] Error in creating the target object : rpc error: code = InvalidArgument desc = no match found in *ocbinds.Device, for path element:"MyCounters" elem:{name:$MyCounters"}
=== RUN   TestGnmiGetMultiNs/Test_empty_path_target
=== RUN   TestGnmiGetMultiNs/Get_valid_but_non-existing_node
=== RUN   TestGnmiGetMultiNs/Get_COUNTERS_PORT_NAME_MAP
=== RUN   TestGnmiGetMultiNs/get_COUNTERS:Ethernet68
=== RUN   TestGnmiGetMultiNs/get_COUNTERS:Ethernet68_SAI_PORT_STAT_PFC_7_RX_PKTS
=== RUN   TestGnmiGetMultiNs/get_COUNTERS:Ethernet68_Pfcwd
=== RUN   TestGnmiGetMultiNs/get_COUNTERS_(use_vendor_alias):Ethernet68/1
=== RUN   TestGnmiGetMultiNs/get_COUNTERS_(use_vendor_alias):Ethernet68/1_SAI_PORT_STAT_PFC_7_RX_PKTS
=== RUN   TestGnmiGetMultiNs/get_COUNTERS_(use_vendor_alias):Ethernet68/1_Pfcwd
=== RUN   TestGnmiGetMultiNs/get_COUNTERS:Ethernet*
=== RUN   TestGnmiGetMultiNs/get_COUNTERS:Ethernet*_SAI_PORT_STAT_PFC_7_RX_PKTS
=== RUN   TestGnmiGetMultiNs/get_COUNTERS:Ethernet*_Pfcwd
=== RUN   TestGnmiGetMultiNs/get_State_DB_Data_for_SWITCH_CAPABILITY_switch
=== RUN   TestGnmiGetMultiNs/get_osversion/build
=== RUN   TestGnmiGetMultiNs/get_osversion/build_file_load_error
E0427 18:41:56.041761    9141 non_db_client.go:308] Failed to read '/etc/sonic/sonic_version.yml', Cannot access '/etc/sonic/sonic_version.yml'
=== RUN   TestGnmiGetMultiNs/get_osversion/build_file_parse_error
E0427 18:41:56.042256    9141 non_db_client.go:315] Failed to parse '/etc/sonic/sonic_version.yml', yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `not a v...` into client.SonicVersionInfo
=== RUN   TestGnmiGetMultiNs/get_osversion/build_different_value
--- PASS: TestGnmiGetMultiNs (4.84s)
    --- PASS: TestGnmiGetMultiNs/Test_non-existing_path_Target (0.01s)
    --- PASS: TestGnmiGetMultiNs/Test_empty_path_target (0.00s)
    --- PASS: TestGnmiGetMultiNs/Get_valid_but_non-existing_node (0.00s)
    --- PASS: TestGnmiGetMultiNs/Get_COUNTERS_PORT_NAME_MAP (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:Ethernet68 (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:Ethernet68_SAI_PORT_STAT_PFC_7_RX_PKTS (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:Ethernet68_Pfcwd (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS_(use_vendor_alias):Ethernet68/1 (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS_(use_vendor_alias):Ethernet68/1_SAI_PORT_STAT_PFC_7_RX_PKTS (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS_(use_vendor_alias):Ethernet68/1_Pfcwd (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:Ethernet* (0.01s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:Ethernet*_SAI_PORT_STAT_PFC_7_RX_PKTS (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:Ethernet*_Pfcwd (0.01s)
    --- PASS: TestGnmiGetMultiNs/get_State_DB_Data_for_SWITCH_CAPABILITY_switch (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_osversion/build (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_osversion/build_file_load_error (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_osversion/build_file_parse_error (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_osversion/build_different_value (0.00s)
=== RUN   TestGnmiGetTranslib
=== RUN   TestGnmiGetTranslib/Get_OC_Interfaces
=== RUN   TestGnmiGetTranslib/Get_OC_Interface
=== RUN   TestGnmiGetTranslib/Get_OC_Interface_admin-status
=== RUN   TestGnmiGetTranslib/Get_OC_Interface_ifindex
=== RUN   TestGnmiGetTranslib/Get_OC_Interface_mtu
--- PASS: TestGnmiGetTranslib (1.81s)
    --- PASS: TestGnmiGetTranslib/Get_OC_Interfaces (0.04s)
    --- PASS: TestGnmiGetTranslib/Get_OC_Interface (0.00s)
    --- PASS: TestGnmiGetTranslib/Get_OC_Interface_admin-status (0.00s)
    --- PASS: TestGnmiGetTranslib/Get_OC_Interface_ifindex (0.00s)
    --- PASS: TestGnmiGetTranslib/Get_OC_Interface_mtu (0.00s)
PASS
ok      github.com/Azure/sonic-telemetry/gnmi_server    14.346s      
root@abdosi-ubuntu-vm0:/src/sonic-telemetry/gnmi_server# /usr/local/go/bin/go test -mod=vendor  -v github.com/Azure/sonic-telemetry/gnmi_server -run TestGnmiSubscribe -count=1
    --- PASS: TestGnmiSubscribe/stream_query_for_table_COUNTERS_PORT_NAME_MAP_with_new_test_field_field (2.00s)
    --- PASS: TestGnmiSubscribe/stream_query_for_table_key_Ethernet68_with_new_test_field_field (3.00s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_stream_query_for_table_key_Ethernet68/1_with_new_test_field_field (3.00s)
    --- PASS: TestGnmiSubscribe/stream_query_for_COUNTERS/Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_stream_query_for_COUNTERS/[Ethernet68/1]/SAI_PORT_STAT_PFC_7_RX_PKTS_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribe/stream_query_for_COUNTERS/Ethernet68/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_stream_query_for_COUNTERS/[Ethernet68/1]/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribe/stream_query_for_table_key_Ethernet*_with_new_test_field_field_on_Ethernet68 (3.00s)
    --- PASS: TestGnmiSubscribe/stream_query_for_table_key_Ethernet*/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribe/stream_query_for_table_key_Ethernet*/Pfcwd_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribe/poll_query_for_table_COUNTERS_PORT_NAME_MAP_with_new_field_test_field (2.01s)
    --- PASS: TestGnmiSubscribe/poll_query_for_table_COUNTERS_PORT_NAME_MAP_with_test_field_delete (2.00s)
    --- PASS: TestGnmiSubscribe/poll_query_for_COUNTERS/Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_poll_query_for_COUNTERS/[Ethernet68/1]/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribe/poll_query_for_COUNTERS/Ethernet68/Pfcwd_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_poll_query_for_COUNTERS/[Ethernet68/1]/Pfcwd_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribe/poll_query_for_table_key_Ethernet*_with_Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_field_value_change (2.02s)
    --- PASS: TestGnmiSubscribe/poll_query_for_table_key_field_Ethernet*/SAI_PORT_STAT_PFC_7_RX_PKTS_with_Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_field_value_change (2.01s)
    --- PASS: TestGnmiSubscribe/poll_query_for_table_key_field_Etherenet*/Pfcwd_with_Ethernet68:3/PFC_WD_QUEUE_STATS_DEADLOCK_DETECTED_field_value_change (2.03s)
    --- PASS: TestGnmiSubscribe/poll_query_for_COUNTERS/Ethernet*/Queues (1.10s)
    --- PASS: TestGnmiSubscribe/poll_query_for_COUNTERS/Ethernet68/Queues_with_field_value_change (2.01s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_poll_query_for_COUNTERS/Ethernet68/Queues_with_field_value_change (2.01s)
    --- PASS: TestGnmiSubscribe/use_invalid_sample_interval (1.00s)
    --- PASS: TestGnmiSubscribe/sample_stream_query_for_table_key_Ethernet68_with_new_test_field_field (2.00s)
    --- PASS: TestGnmiSubscribe/sample_stream_query_for_COUNTERS/Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_with_2_updates (3.00s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_sample_stream_query_for_table_key_Ethernet68/1_with_new_test_field_field (3.00s)
    --- PASS: TestGnmiSubscribe/sample_stream_query_for_COUNTERS/Ethernet68/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribe/(use_vendor_alias)_sample_stream_query_for_COUNTERS/[Ethernet68/1]/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribe/sample_stream_query_for_table_key_Ethernet*_with_new_test_field_field_on_Ethernet68 (2.00s)
    --- PASS: TestGnmiSubscribe/(updates_only)_sample_stream_query_for_table_key_Ethernet*_with_new_test_field_field_on_Ethernet68 (4.00s)
    --- PASS: TestGnmiSubscribe/sample_stream_query_for_table_key_Ethernet*/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribe/sample_stream_query_for_table_key_Ethernet*/Pfcwd_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribe/(update_only)_sample_stream_query_for_table_key_Ethernet*/Pfcwd_with_field_value_update (4.00s)
--- PASS: TestGnmiSubscribeMultiNs (115.26s)
    --- PASS: TestGnmiSubscribeMultiNs/stream_query_for_table_COUNTERS_PORT_NAME_MAP_with_new_test_field_field (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/stream_query_for_table_key_Ethernet68_with_new_test_field_field (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_stream_query_for_table_key_Ethernet68/1_with_new_test_field_field (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/stream_query_for_COUNTERS/Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_stream_query_for_COUNTERS/[Ethernet68/1]/SAI_PORT_STAT_PFC_7_RX_PKTS_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/stream_query_for_COUNTERS/Ethernet68/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_stream_query_for_COUNTERS/[Ethernet68/1]/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/stream_query_for_table_key_Ethernet*_with_new_test_field_field_on_Ethernet68 (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/stream_query_for_table_key_Ethernet*/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/stream_query_for_table_key_Ethernet*/Pfcwd_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_table_COUNTERS_PORT_NAME_MAP_with_new_field_test_field (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_table_COUNTERS_PORT_NAME_MAP_with_test_field_delete (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_COUNTERS/Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_poll_query_for_COUNTERS/[Ethernet68/1]/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_COUNTERS/Ethernet68/Pfcwd_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_poll_query_for_COUNTERS/[Ethernet68/1]/Pfcwd_with_field_value_change (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_table_key_Ethernet*_with_Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_field_value_change (2.02s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_table_key_field_Ethernet*/SAI_PORT_STAT_PFC_7_RX_PKTS_with_Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_field_value_change (2.01s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_table_key_field_Etherenet*/Pfcwd_with_Ethernet68:3/PFC_WD_QUEUE_STATS_DEADLOCK_DETECTED_field_value_change (2.03s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_COUNTERS/Ethernet*/Queues (1.08s)
    --- PASS: TestGnmiSubscribeMultiNs/poll_query_for_COUNTERS/Ethernet68/Queues_with_field_value_change (2.01s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_poll_query_for_COUNTERS/Ethernet68/Queues_with_field_value_change (2.01s)
    --- PASS: TestGnmiSubscribeMultiNs/use_invalid_sample_interval (1.00s)
    --- PASS: TestGnmiSubscribeMultiNs/sample_stream_query_for_table_key_Ethernet68_with_new_test_field_field (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/sample_stream_query_for_COUNTERS/Ethernet68/SAI_PORT_STAT_PFC_7_RX_PKTS_with_2_updates (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_sample_stream_query_for_table_key_Ethernet68/1_with_new_test_field_field (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/sample_stream_query_for_COUNTERS/Ethernet68/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(use_vendor_alias)_sample_stream_query_for_COUNTERS/[Ethernet68/1]/Pfcwd_with_update_of_field_value (3.00s)
    --- PASS: TestGnmiSubscribeMultiNs/sample_stream_query_for_table_key_Ethernet*_with_new_test_field_field_on_Ethernet68 (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(updates_only)_sample_stream_query_for_table_key_Ethernet*_with_new_test_field_field_on_Ethernet68 (4.00s)
    --- PASS: TestGnmiSubscribeMultiNs/sample_stream_query_for_table_key_Ethernet*/SAI_PORT_STAT_PFC_7_RX_PKTS_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/sample_stream_query_for_table_key_Ethernet*/Pfcwd_with_field_value_update (2.00s)
    --- PASS: TestGnmiSubscribeMultiNs/(update_only)_sample_stream_query_for_table_key_Ethernet*/Pfcwd_with_field_value_update (4.00s)
PASS
ok      github.com/Azure/sonic-telemetry/gnmi_server    230.306s
  1. Newly added sonic_db_config testcases passed.
root@abdosi-ubuntu-vm0:/src/sonic-telemetry/gnmi_server# /usr/local/go/bin/go test -mod=vendor  -v github.com/Azure/sonic-telemetry/sonic_db_config -count=1
=== RUN   TestGetDb
=== RUN   TestGetDb/Id
=== RUN   TestGetDb/Sock
=== RUN   TestGetDb/AllNamespaces
=== RUN   TestGetDb/TcpAddr
--- PASS: TestGetDb (0.00s)
    --- PASS: TestGetDb/Id (0.00s)
    --- PASS: TestGetDb/Sock (0.00s)
    --- PASS: TestGetDb/AllNamespaces (0.00s)
    --- PASS: TestGetDb/TcpAddr (0.00s)
=== RUN   TestGetDbMultiNs
=== RUN   TestGetDbMultiNs/Id
=== RUN   TestGetDbMultiNs/Sock
=== RUN   TestGetDbMultiNs/AllNamespaces
=== RUN   TestGetDbMultiNs/TcpAddr
--- PASS: TestGetDbMultiNs (0.00s)
    --- PASS: TestGetDbMultiNs/Id (0.00s)
    --- PASS: TestGetDbMultiNs/Sock (0.00s)
    --- PASS: TestGetDbMultiNs/AllNamespaces (0.00s)
    --- PASS: TestGetDbMultiNs/TcpAddr (0.00s)
PASS
ok      github.com/Azure/sonic-telemetry/sonic_db_config        0.005s
  1. Verified no impact on dial-out client (Support Single namespace/asic only)
root@abdosi-ubuntu-vm0:/src/sonic-telemetry/gnmi_server# /usr/local/go/bin/go test -mod=vendor  -v github.com/Azure/sonic-telemetry/dialout/dialout_client -count=1
=== RUN   TestGNMIDialOutPublish
=== RUN   TestGNMIDialOutPublish/DialOut_to_first_collector_in_stream_mode_and_synced
=== RUN   TestGNMIDialOutPublish/DialOut_to_second_collector_in_stream_mode_upon_failure_of_first_collector
--- PASS: TestGNMIDialOutPublish (11.38s)
    --- PASS: TestGNMIDialOutPublish/DialOut_to_first_collector_in_stream_mode_and_synced (0.51s)
    --- PASS: TestGNMIDialOutPublish/DialOut_to_second_collector_in_stream_mode_upon_failure_of_first_collector (7.51s)
PASS
ok      github.com/Azure/sonic-telemetry/dialout/dialout_client 17.584s

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
for single and multi namespace/asic.

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
@abdosi abdosi changed the title Multiasic [multi-asic] Added Support for multi-asic for telemetry/gnmi server Apr 27, 2021
@abdosi abdosi marked this pull request as ready for review April 27, 2021 18:55
@abdosi
Copy link
Contributor Author

abdosi commented Apr 27, 2021

@macikgozwa Somehow cannot add you in reviewers so tagging you.

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Makefile Outdated

clean:
$(RM) -r build
$(RM) -r vendor
$(RM) -r ${DBDIR}
Copy link
Contributor

@qiluo-msft qiluo-msft Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DBDIR

this is created by sudo, could you clean without sudo? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes updated and needed in Azure Pipeline setup. In local docker it was fine as running as root so got missed.

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
@qiluo-msft
Copy link
Contributor

@pra-moh @hui-ma Could you help review?

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

sonic_data_client/db_client.go Outdated Show resolved Hide resolved
sonic_data_client/db_client.go Outdated Show resolved Hide resolved
sonic_data_client/virtual_db.go Outdated Show resolved Hide resolved
sonic_db_config/db_config.go Outdated Show resolved Hide resolved
sonic_db_config/db_config.go Show resolved Hide resolved
sonic_db_config/db_config.go Show resolved Hide resolved
sonic_data_client/db_client.go Show resolved Hide resolved
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
@anshuv-mfst
Copy link

Hi @reshmaintel - please assign reviewers from Intel team, thanks.

@hui-ma
Copy link
Collaborator

hui-ma commented May 10, 2021

"If the “/ASICX” is not present, then request will map to default namespace (existing behavior will be achieved", does this rule also
apply to counter_DB? or the counter_DB has its own rule for namespace? From the example in your test result, don't know how to identify the interface from different ASIC.

@reshmaintel
Copy link

Hi @akokhan could you please review this PR. Thanks

@abdosi
Copy link
Contributor Author

abdosi commented May 14, 2021

"If the “/ASICX” is not present, then request will map to default namespace (existing behavior will be achieved", does this rule also
apply to counter_DB? or the counter_DB has its own rule for namespace? From the example in your test result, don't know how to identify the interface from different ASIC.

@hui-ma for the counter DB we support V2R mapping dataset for which this PR (as mention in design document) get information from all ASIC's counter DB. As of now this PR don't support passing /ASICx for Counter Db V2R set and log error for this case. However in future this is extendable when Counter DB has any dataset that needs it.

@abdosi
Copy link
Contributor Author

abdosi commented May 14, 2021

@macikgozwa can you please review/approve again.

@abdosi
Copy link
Contributor Author

abdosi commented May 19, 2021

@hui-ma and @@macikgozwa is it ok to approve/merge this . Can you please check.

sonic_db_config/db_config.go Outdated Show resolved Hide resolved
sonic_db_config/db_config.go Outdated Show resolved Hide resolved
sonic_db_config/db_config_test.go Outdated Show resolved Hide resolved
sonic_db_config/db_config_test.go Outdated Show resolved Hide resolved
sonic_db_config/db_config_test.go Outdated Show resolved Hide resolved
sonic_db_config/db_config_test.go Show resolved Hide resolved
sonic_data_client/db_client.go Outdated Show resolved Hide resolved
sonic_data_client/db_client.go Outdated Show resolved Hide resolved
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
@abdosi
Copy link
Contributor Author

abdosi commented Jun 1, 2021

@hui-ma can we review/approve this ?

tlsConfig := &tls.Config{InsecureSkipVerify: true}
opts := []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))}

//targetAddr := "30.57.185.38:8080"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this comment is redundant it can be removed. (Same for other comments)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, we can do cleanup as part of other PR.

pfcwdName_map[name] = make(map[string]string)
}
for _, key := range resp {
name := key[13:]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add a comment, to explain what is the magic number 13?
I see, that it was done before this PR, but if you can add comment, it will simplify the code reading.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this represent the name in key. Best place to see different key name used in in SONiC is to use to refer schema.
https://github.com/Azure/sonic-swss-common/blob/master/common/schema.h

@@ -419,7 +468,7 @@ func v2rEthPortPfcwdStats(paths []string) ([]tablePath, error) {
// Populate real data paths from paths like
// [COUNTER_DB COUNTERS Ethernet* Queues] or [COUNTER_DB COUNTERS Ethernet68 Queues]
func v2rEthPortQueStats(paths []string) ([]tablePath, error) {
separator, _ := GetTableKeySeparator(paths[DbIdx])
separator, _ := GetTableKeySeparator(paths[DbIdx], "")
Copy link

@globaltrouble globaltrouble Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the blank string is intended to get separator for default namespace, it's better to use constant for the default namespace sonic_db_config.db_config.SONIC_DEFAULT_NAMESPACE or GetDbDefaultNamespace() from the same package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even though value is same the SONIC_DEFAULT_NAMESPACE is used for some other purpose and has different meaning. To replace constant we will need to use other macro. This can be enhanced as part of other pr regarding cleanup the code

sonic_db_config/db_config.go Show resolved Hide resolved
@macikgozwa
Copy link
Contributor

macikgozwa commented Jun 9, 2021

This is a comment for db_client.go line 132:

	if prefix.GetTarget() == "COUNTERS_DB" {
		err = initCountersPortNameMap()
		if err != nil {
			return nil, err
		}
               
               // Code to initialize other maps...
	}

This code wouldn't run in case target has a asic name segment. I recall COUNTERS_DB is not supported for multi asic queries.
However, COUNTERS_DB/asic0 doesn't give me an error:

update: <
  timestamp: 1623266624421030390
  prefix: <
    target: "COUNTERS_DB/asic0"
  >
  update: <
    path: <
      elem: <
        name: "COUNTERS"
      >
      elem: <
        name: "Ethernet0"
      >
    >
    val: <
      string_val: ""
    >
  >
>

sync_response: true

Compare to the query without asic suffix (on the same environment):

update: <
  timestamp: 1623266666110051137
  prefix: <
    target: "COUNTERS_DB"
  >
  update: <
    path: <
      elem: <
        name: "COUNTERS"
      >
      elem: <
        name: "Ethernet0"
      >
    >
    val: <
      json_ietf_val: "{\"SAI_PORT_STAT_ETHER_IN_PKTS_128_TO_255_OCTETS\":\"0\",\"SAI_PORT_STAT_ETHER_RX_OVERSIZE_PKTS\":\"0\",\"SAI_PORT_STAT_ETHER_STATS_TX_NO_ERRORS\":\"0\",\"SAI_PORT_STAT_ETHER_TX_OVERSIZE_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_BROADCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_DISCARDS\":\"0\",\"SAI_PORT_STAT_IF_IN_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_IN_MULTICAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_NON_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_OCTETS\":\"0\",\"SAI_PORT_STAT_IF_IN_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_UNKNOWN_PROTOS\":\"0\",\"SAI_PORT_STAT_IF_OUT_BROADCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_OUT_DISCARDS\":\"0\",\"SAI_PORT_STAT_IF_OUT_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_OUT_MULTICAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_OUT_NON_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_OUT_OCTETS\":\"0\",\"SAI_PORT_STAT_IF_OUT_QLEN\":\"0\",\"SAI_PORT_STAT_IF_OUT_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IP_IN_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_0_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_0_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_1_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_1_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_2_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_2_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_3_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_3_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_4_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_4_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_5_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_5_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_6_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_6_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_7_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_7_TX_PKTS\":\"0\"}"
    >
  >
>

sync_response: true

If COUNTERS_DB is not supported shouldn't give it an error right away?

UPDATE:
In fact it returns a proper error if there was a legit COUNTERS_DB query that proceeding the COUNTERS_DB/asic0 query. That legit query must be initializing something that allows the v2r check for COUNTERS_DB/asic0 return result (hence give the proper error message). Though, I didn't dig deeper what is that initialization that first query triggers.

panic(fmt.Errorf("Global Database config file is not valid(multiple include for same namespace!"))
}
//Ref:https://www.geeksforgeeks.org/filepath-join-function-in-golang-with-examples/
db_include_file := filepath.Join(dir, entry.(map[string]interface{})["include"].(string))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is taking dir for the first param, the include path has to be a relative path (to the global file path). e.g. It wouldn't accept full paths.
I don't think it is an issue, but something to be aware of.

Copy link
Contributor Author

@abdosi abdosi Jun 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@macikgozwa the same file is used in other places also. So we should be fine. Eg: https://github.com/Azure/sonic-swss-common/blob/master/common/dbconnector.cpp#L219

@@ -62,7 +62,7 @@ type Stream interface {
var UseRedisLocalTcpPort bool = false

// redis client connected to each DB
var Target2RedisDb = make(map[string]*redis.Client)
var Target2RedisDb = make(map[string]map[string]*redis.Client)
Copy link

@roweisch roweisch Jun 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am new to go, but could you explain why this map[string] is repeated here? Does this mean 2D array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roweisch yes. Basically we have {dbname} to {redis client} mapping .. now we have {namespace, dbname} to {redis client} mapping.

path then always return error.

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
@abdosi
Copy link
Contributor Author

abdosi commented Jun 11, 2021

This is a comment for db_client.go line 132:

	if prefix.GetTarget() == "COUNTERS_DB" {
		err = initCountersPortNameMap()
		if err != nil {
			return nil, err
		}
               
               // Code to initialize other maps...
	}

This code wouldn't run in case target has a asic name segment. I recall COUNTERS_DB is not supported for multi asic queries.
However, COUNTERS_DB/asic0 doesn't give me an error:

update: <
  timestamp: 1623266624421030390
  prefix: <
    target: "COUNTERS_DB/asic0"
  >
  update: <
    path: <
      elem: <
        name: "COUNTERS"
      >
      elem: <
        name: "Ethernet0"
      >
    >
    val: <
      string_val: ""
    >
  >
>

sync_response: true

Compare to the query without asic suffix (on the same environment):

update: <
  timestamp: 1623266666110051137
  prefix: <
    target: "COUNTERS_DB"
  >
  update: <
    path: <
      elem: <
        name: "COUNTERS"
      >
      elem: <
        name: "Ethernet0"
      >
    >
    val: <
      json_ietf_val: "{\"SAI_PORT_STAT_ETHER_IN_PKTS_128_TO_255_OCTETS\":\"0\",\"SAI_PORT_STAT_ETHER_RX_OVERSIZE_PKTS\":\"0\",\"SAI_PORT_STAT_ETHER_STATS_TX_NO_ERRORS\":\"0\",\"SAI_PORT_STAT_ETHER_TX_OVERSIZE_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_BROADCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_DISCARDS\":\"0\",\"SAI_PORT_STAT_IF_IN_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_IN_MULTICAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_NON_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_OCTETS\":\"0\",\"SAI_PORT_STAT_IF_IN_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_IN_UNKNOWN_PROTOS\":\"0\",\"SAI_PORT_STAT_IF_OUT_BROADCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_OUT_DISCARDS\":\"0\",\"SAI_PORT_STAT_IF_OUT_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_OUT_MULTICAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_OUT_NON_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IF_OUT_OCTETS\":\"0\",\"SAI_PORT_STAT_IF_OUT_QLEN\":\"0\",\"SAI_PORT_STAT_IF_OUT_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_IP_IN_UCAST_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_0_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_0_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_1_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_1_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_2_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_2_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_3_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_3_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_4_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_4_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_5_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_5_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_6_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_6_TX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_7_RX_PKTS\":\"0\",\"SAI_PORT_STAT_PFC_7_TX_PKTS\":\"0\"}"
    >
  >
>

sync_response: true

If COUNTERS_DB is not supported shouldn't give it an error right away?

UPDATE:
In fact it returns a proper error if there was a legit COUNTERS_DB query that proceeding the COUNTERS_DB/asic0 query. That legit query must be initializing something that allows the v2r check for COUNTERS_DB/asic0 return result (hence give the proper error message). Though, I didn't dig deeper what is that initialization that first query triggers.

Thanks @macikgozwa I have fixed this in latest commit. Also added unit test case for same.

@abdosi
Copy link
Contributor Author

abdosi commented Jun 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@abdosi
Copy link
Contributor Author

abdosi commented Jun 11, 2021

@lguohan @liushilongbuaa can you plese help check azure pipeline build failure.

We are not able to down artifact for sonic-mgmt-common repo.

@hui-ma
Copy link
Collaborator

hui-ma commented Jun 12, 2021

See failure like below in utest. It is expected failure?
E0427 18:41:56.041761 9141 non_db_client.go:308] Failed to read '/etc/sonic/sonic_version.yml', Cannot access '/etc/sonic/sonic_version.yml'

@hui-ma this is negative test case I belive added by @macikgozwa

@macikgozwa
Copy link
Contributor

See failure like below in utest. It is expected failure?
E0427 18:41:56.041761 9141 non_db_client.go:308] Failed to read '/etc/sonic/sonic_version.yml', Cannot access '/etc/sonic/sonic_version.yml'

@hui-ma this is negative test case I belive added by @macikgozwa

Yes, we have a negative case to test what happens when the version file is missing. @hui-ma @abdosi

@abdosi
Copy link
Contributor Author

abdosi commented Jun 13, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@abdosi abdosi merged commit 6df988c into sonic-net:master Jun 14, 2021
@abdosi abdosi deleted the multiasic branch June 14, 2021 17:35
abdosi added a commit that referenced this pull request Jul 28, 2021
As part of PR: #77 i added removal of DB Directory (/var/run/redis) as part of make clean. This is causing issue where other debian package test fails (as they don't see database_config.json) .
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants