resource: Handle lists correctly in item_matches

We want to handle lists in the same way as we handle them in combine().
Without this commit, reserve()->find() failed to match objects
containing dictionaries inside lists correctly (such as trx configs).

A few attributes are added to trx_list of some resources in
suite_test/resources.conf to show a case in which resource reservation
would fail without this patch. It failed because before this patch,
dictionaries inside lists are compared to be equal instead of being
compared element by element to see if one dictionary is a subset of the
other one (for each element in the lists).

Change-Id: I8588d5b788b9f74a9cc84b8bdcb049921788bb48
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 8206767..150e28b 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -431,10 +431,22 @@
     if is_list(wanted_item):
         if not is_list(item):
             return False
-        # multiple possible values
-        for val in wanted_item:
-            if val not in item:
-                return False
+        # Validate that all elements in both lists are of the same type:
+        t = util.list_validate_same_elem_type(wanted_item + item)
+        if t is None:
+            return True # both lists are empty, return
+        # For lists of complex objects, we expect them to be sorted lists:
+        if t in (dict, list, tuple):
+            for i in range(max(len(wanted_item), len(item))):
+                log.ctx(idx=i)
+                subitem = item[i] if i < len(item) else util.empty_instance_type(t)
+                wanted_subitem = wanted_item[i] if i < len(wanted_item) else util.empty_instance_type(t)
+                if not item_matches(subitem, wanted_subitem, ignore_keys=ignore_keys):
+                    return False
+        else: # for lists of basic elements, we handle them as unsorted sets:
+            for val in wanted_item:
+                if val not in item:
+                    return False
         return True
 
     return item == wanted_item