@@ -46,7 +46,8 @@ def setReadOnlyAttr(dvs, obj, attr, val):
4646 assert len (keys ) == 1
4747
4848 swVid = keys [0 ]
49- r = redis .Redis (unix_socket_path = dvs .redis_sock , db = swsscommon .ASIC_DB )
49+ r = redis .Redis (unix_socket_path = dvs .redis_sock , db = swsscommon .ASIC_DB ,
50+ encoding = "utf-8" , decode_responses = True )
5051 swRid = r .hget ("VIDTORID" , swVid )
5152
5253 assert swRid is not None
@@ -701,225 +702,225 @@ def test_CrmAcl(self, dvs, testlog):
701702 assert key not in keys
702703
703704 def test_CrmAclGroup (self , dvs , testlog ):
704-
705+
705706 db = swsscommon .DBConnector (4 , dvs .redis_sock , 0 )
706707 adb = swsscommon .DBConnector (1 , dvs .redis_sock , 0 )
707-
708+
708709 dvs .runcmd ("crm config polling interval 1" )
709710 bind_ports = ["Ethernet0" , "Ethernet4" , "Ethernet8" ]
710-
711+
711712 # create ACL table
712713 tbl = swsscommon .Table (db , "ACL_TABLE" )
713714 fvs = swsscommon .FieldValuePairs ([("policy_desc" , "testv6" ), ("type" , "L3V6" ), ("ports" , "," .join (bind_ports ))])
714715 tbl .set ("test-aclv6" , fvs )
715-
716+
716717 time .sleep (2 )
717718 atbl = swsscommon .Table (adb , "ASIC_STATE:SAI_OBJECT_TYPE_ACL_TABLE_GROUP" )
718719 entry_used_counter = getCrmCounterValue (dvs , 'ACL_STATS:INGRESS:PORT' , 'crm_stats_acl_group_used' )
719720 assert entry_used_counter == 3
720-
721+
721722 # remove ACL table
722723 #tbl._del("test-aclv6")
723724 #time.sleep(2)
724725 #atbl = swsscommon.Table(adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_TABLE_GROUP")
725726 #table_used_counter = getCrmCounterValue(dvs, 'ACL_STATS:INGRESS:PORT', 'crm_stats_acl_group_used')
726727 #assert table_used_counter == 0
727-
728+
728729 def test_Configure (self , dvs , testlog ):
729-
730+
730731 #polling interval
731732 dvs .runcmd ("crm config polling interval 10" )
732733 time .sleep (2 )
733734 polling_interval = getCrmConfigValue (dvs , 'Config' , 'polling_interval' )
734735 assert polling_interval == 10
735-
736+
736737 def test_Configure_ipv4_route (self , dvs , testlog ):
737-
738+
738739 #ipv4 route low/high threshold/type
739740 dvs .runcmd ("crm config thresholds ipv4 route low 50" )
740741 dvs .runcmd ("crm config thresholds ipv4 route high 90" )
741742 dvs .runcmd ("crm config thresholds ipv4 route type percentage" )
742-
743+
743744 time .sleep (2 )
744745 threshold_low = getCrmConfigValue (dvs , 'Config' , 'ipv4_route_low_threshold' )
745746 assert threshold_low == 50
746747 threshold_high = getCrmConfigValue (dvs , 'Config' , 'ipv4_route_high_threshold' )
747748 assert threshold_high == 90
748749 threshold_type = getCrmConfigStr (dvs , 'Config' , 'ipv4_route_threshold_type' )
749750 assert threshold_type == 'percentage'
750-
751+
751752 def test_Configure_ipv6_route (self , dvs , testlog ):
752-
753+
753754 #ipv6 route low/high threshold/type
754755 dvs .runcmd ("crm config thresholds ipv6 route low 50" )
755756 dvs .runcmd ("crm config thresholds ipv6 route high 90" )
756757 dvs .runcmd ("crm config thresholds ipv6 route type used" )
757-
758+
758759 time .sleep (2 )
759760 threshold_low = getCrmConfigValue (dvs , 'Config' , 'ipv6_route_low_threshold' )
760761 assert threshold_low == 50
761762 threshold_high = getCrmConfigValue (dvs , 'Config' , 'ipv6_route_high_threshold' )
762763 assert threshold_high == 90
763764 threshold_type = getCrmConfigStr (dvs , 'Config' , 'ipv6_route_threshold_type' )
764765 assert threshold_type == 'used'
765-
766+
766767 def test_Configure_ipv4_nexthop (self , dvs , testlog ):
767-
768+
768769 #ipv4 nexthop low/high threshold/type
769770 dvs .runcmd ("crm config thresholds ipv4 nexthop low 50" )
770771 dvs .runcmd ("crm config thresholds ipv4 nexthop high 90" )
771772 dvs .runcmd ("crm config thresholds ipv4 nexthop type 'percentage'" )
772-
773+
773774 time .sleep (2 )
774775 threshold_low = getCrmConfigValue (dvs , 'Config' , 'ipv4_nexthop_low_threshold' )
775776 assert threshold_low == 50
776777 threshold_high = getCrmConfigValue (dvs , 'Config' , 'ipv4_nexthop_high_threshold' )
777778 assert threshold_high == 90
778779 threshold_type = getCrmConfigStr (dvs , 'Config' , 'ipv4_nexthop_threshold_type' )
779780 assert threshold_type == 'percentage'
780-
781+
781782 def test_Configure_ipv6_nexthop (self , dvs , testlog ):
782-
783+
783784 #ipv6 nexthop low/high threshold/type
784785 dvs .runcmd ("crm config thresholds ipv6 nexthop low 50" )
785786 dvs .runcmd ("crm config thresholds ipv6 nexthop high 90" )
786787 dvs .runcmd ("crm config thresholds ipv6 nexthop type free" )
787-
788+
788789 time .sleep (2 )
789790 threshold_low = getCrmConfigValue (dvs , 'Config' , 'ipv6_nexthop_low_threshold' )
790791 assert threshold_low == 50
791792 threshold_high = getCrmConfigValue (dvs , 'Config' , 'ipv6_nexthop_high_threshold' )
792793 assert threshold_high == 90
793794 threshold_type = getCrmConfigStr (dvs , 'Config' , 'ipv6_nexthop_threshold_type' )
794795 assert threshold_type == 'free'
795-
796+
796797 def test_Configure_ipv4_neighbor (self , dvs , testlog ):
797-
798+
798799 #ipv4 neighbor low/high threshold/type
799800 dvs .runcmd ("crm config thresholds ipv4 neighbor low 50" )
800801 dvs .runcmd ("crm config thresholds ipv4 neighbor high 90" )
801802 dvs .runcmd ("crm config thresholds ipv4 neighbor type percentage" )
802-
803+
803804 time .sleep (2 )
804805 threshold_low = getCrmConfigValue (dvs , 'Config' , 'ipv4_neighbor_low_threshold' )
805806 assert threshold_low == 50
806807 threshold_high = getCrmConfigValue (dvs , 'Config' , 'ipv4_neighbor_high_threshold' )
807808 assert threshold_high == 90
808809 threshold_type = getCrmConfigStr (dvs , 'Config' , 'ipv4_neighbor_threshold_type' )
809810 assert threshold_type == 'percentage'
810-
811+
811812 def test_Configure_ipv6_neighbor (self , dvs , testlog ):
812-
813+
813814 #ipv6 neighbor low/high threshold/type
814815 dvs .runcmd ("crm config thresholds ipv6 neighbor low 50" )
815816 dvs .runcmd ("crm config thresholds ipv6 neighbor high 90" )
816817 dvs .runcmd ("crm config thresholds ipv6 neighbor type used" )
817-
818+
818819 time .sleep (2 )
819820 threshold_low = getCrmConfigValue (dvs , 'Config' , 'ipv6_neighbor_low_threshold' )
820821 assert threshold_low == 50
821822 threshold_high = getCrmConfigValue (dvs , 'Config' , 'ipv6_neighbor_high_threshold' )
822823 assert threshold_high == 90
823824 threshold_type = getCrmConfigStr (dvs , 'Config' , 'ipv6_neighbor_threshold_type' )
824825 assert threshold_type == 'used'
825-
826+
826827 def test_Configure_group_member (self , dvs , testlog ):
827-
828+
828829 #nexthop group member low/high threshold/type
829830 dvs .runcmd ("crm config thresholds nexthop group member low 50" )
830831 dvs .runcmd ("crm config thresholds nexthop group member high 90" )
831832 dvs .runcmd ("crm config thresholds nexthop group member type percentage" )
832-
833+
833834 time .sleep (2 )
834835 threshold_low = getCrmConfigValue (dvs , 'Config' , 'nexthop_group_member_low_threshold' )
835836 assert threshold_low == 50
836837 threshold_high = getCrmConfigValue (dvs , 'Config' , 'nexthop_group_member_high_threshold' )
837838 assert threshold_high == 90
838839 threshold_type = getCrmConfigStr (dvs , 'Config' , 'nexthop_group_member_threshold_type' )
839840 assert threshold_type == 'percentage'
840-
841+
841842 def test_Configure_group_object (self , dvs , testlog ):
842-
843+
843844 #nexthop group object low/high threshold/type
844845 dvs .runcmd ("crm config thresholds nexthop group object low 50" )
845846 dvs .runcmd ("crm config thresholds nexthop group object high 90" )
846847 dvs .runcmd ("crm config thresholds nexthop group object type free" )
847-
848+
848849 time .sleep (2 )
849850 threshold_low = getCrmConfigValue (dvs , 'Config' , 'nexthop_group_low_threshold' )
850851 assert threshold_low == 50
851852 threshold_high = getCrmConfigValue (dvs , 'Config' , 'nexthop_group_high_threshold' )
852853 assert threshold_high == 90
853854 threshold_type = getCrmConfigStr (dvs , 'Config' , 'nexthop_group_threshold_type' )
854855 assert threshold_type == 'free'
855-
856+
856857 def test_Configure_acl_table (self , dvs , testlog ):
857-
858+
858859 #thresholds acl table low/high threshold/type
859860 dvs .runcmd ("crm config thresholds acl table low 50" )
860861 dvs .runcmd ("crm config thresholds acl table high 90" )
861862 dvs .runcmd ("crm config thresholds acl table type percentage" )
862-
863+
863864 time .sleep (2 )
864865 threshold_low = getCrmConfigValue (dvs , 'Config' , 'acl_table_low_threshold' )
865866 assert threshold_low == 50
866867 threshold_high = getCrmConfigValue (dvs , 'Config' , 'acl_table_high_threshold' )
867868 assert threshold_high == 90
868869 threshold_type = getCrmConfigStr (dvs , 'Config' , 'acl_table_threshold_type' )
869870 assert threshold_type == 'percentage'
870-
871+
871872 def test_Configure_acl_group (self , dvs , testlog ):
872-
873+
873874 #thresholds acl group low/high threshold/type
874875 dvs .runcmd ("crm config thresholds acl group low 50" )
875876 dvs .runcmd ("crm config thresholds acl group high 90" )
876877 dvs .runcmd ("crm config thresholds acl group type used" )
877-
878+
878879 time .sleep (2 )
879880 threshold_low = getCrmConfigValue (dvs , 'Config' , 'acl_group_low_threshold' )
880881 assert threshold_low == 50
881882 threshold_high = getCrmConfigValue (dvs , 'Config' , 'acl_group_high_threshold' )
882883 assert threshold_high == 90
883884 threshold_type = getCrmConfigStr (dvs , 'Config' , 'acl_group_threshold_type' )
884885 assert threshold_type == 'used'
885-
886+
886887 def test_Configure_acl_group_entry (self , dvs , testlog ):
887-
888+
888889 #thresholds acl group entry low/high threshold/type
889890 dvs .runcmd ("crm config thresholds acl group entry low 50" )
890891 dvs .runcmd ("crm config thresholds acl group entry high 90" )
891892 dvs .runcmd ("crm config thresholds acl group entry type percentage" )
892-
893+
893894 time .sleep (2 )
894895 threshold_low = getCrmConfigValue (dvs , 'Config' , 'acl_entry_low_threshold' )
895896 assert threshold_low == 50
896897 threshold_high = getCrmConfigValue (dvs , 'Config' , 'acl_entry_high_threshold' )
897898 assert threshold_high == 90
898899 threshold_type = getCrmConfigStr (dvs , 'Config' , 'acl_entry_threshold_type' )
899900 assert threshold_type == 'percentage'
900-
901+
901902 def test_Configure_acl_group_counter (self , dvs , testlog ):
902-
903+
903904 #thresholds acl group counter low/high threshold/type
904905 dvs .runcmd ("crm config thresholds acl group counter low 50" )
905906 dvs .runcmd ("crm config thresholds acl group counter high 90" )
906907 dvs .runcmd ("crm config thresholds acl group counter type free" )
907-
908+
908909 time .sleep (2 )
909910 threshold_low = getCrmConfigValue (dvs , 'Config' , 'acl_counter_low_threshold' )
910911 assert threshold_low == 50
911912 threshold_high = getCrmConfigValue (dvs , 'Config' , 'acl_counter_high_threshold' )
912913 assert threshold_high == 90
913914 threshold_type = getCrmConfigStr (dvs , 'Config' , 'acl_counter_threshold_type' )
914915 assert threshold_type == 'free'
915-
916+
916917 def test_Configure_fdb (self , dvs , testlog ):
917-
918+
918919 #thresholds fdb low/high threshold/type
919920 dvs .runcmd ("crm config thresholds fdb low 50" )
920921 dvs .runcmd ("crm config thresholds fdb high 90" )
921922 dvs .runcmd ("crm config thresholds fdb type percentage" )
922-
923+
923924 time .sleep (2 )
924925 threshold_low = getCrmConfigValue (dvs , 'Config' , 'fdb_entry_low_threshold' )
925926 assert threshold_low == 50
0 commit comments