feat(core): Bind/unbind 16/42616/5
authorPeter Mikus <[email protected]>
Tue, 1 Apr 2025 10:39:59 +0000 (12:39 +0200)
committerPeter Mikus <[email protected]>
Wed, 2 Apr 2025 07:21:26 +0000 (07:21 +0000)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: I7e1398b110356ae5682db3e1b811bc1bbe41398e

resources/libraries/python/DUTSetup.py

index 8c240d9..1f5a48a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -392,7 +392,9 @@ class DUTSetup:
         :type pci_addrs: list
         """
         for pci_addr in pci_addrs:
-            DUTSetup.pci_driver_unbind(node, pci_addr)
+            cur_driver = DUTSetup.get_pci_dev_driver(node, pci_addr)
+            if cur_driver:
+                DUTSetup.pci_driver_unbind(node, pci_addr)
             DUTSetup.pci_driver_bind(node, pci_addr, driver)
 
     @staticmethod