R10 tag/path update
[dcaegen2/platform/plugins.git] / k8s / k8splugin / discovery.py
index 56f8260..99f5023 100644 (file)
@@ -1,7 +1,8 @@
 # ============LICENSE_START=======================================================
 # org.onap.dcae
 # ================================================================================
-# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2019 Pantheon.tech. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -16,7 +17,6 @@
 # limitations under the License.
 # ============LICENSE_END=========================================================
 #
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
 
 import json
 import logging
@@ -233,12 +233,10 @@ def add_to_entry(conn, key, add_name, add_value):
 
 def _find_matching_services(services, name_search, tags):
     """Find matching services given search criteria"""
-    def is_match(service):
-        srv_name, srv_tags = service
-        return name_search in srv_name and \
-                all(map(lambda tag: tag in srv_tags, tags))
+    tags = set(tags)
+    return [srv_name for srv_name in services
+            if name_search in srv_name and tags <= set(services[srv_name])]
 
-    return [ srv[0] for srv in services.items() if is_match(srv) ]
 
 def search_services(conn, name_search, tags):
     """Search for services that match criteria