From 36e9b3433b488d7c3bcb65fc76553ed3bc736398 Mon Sep 17 00:00:00 2001
From: Jorge Sasiain <jorge.sasiain@ehu.eus>
Date: Thu, 16 Nov 2023 08:57:05 +0000
Subject: [PATCH] Address SonarQube code smells

---
 gso/services/netbox_client.py            |  2 +-
 gso/utils/device_info.py                 |  4 ++--
 gso/workflows/iptrunk/migrate_iptrunk.py | 12 +++++++-----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gso/services/netbox_client.py b/gso/services/netbox_client.py
index 47d2f6e87..f36ee6f2b 100644
--- a/gso/services/netbox_client.py
+++ b/gso/services/netbox_client.py
@@ -160,7 +160,7 @@ class NetboxClient:
     def create_device(self, device_name: str, site_tier: str) -> Devices:
         """Create a new device in Netbox."""
         # Get device type id
-        tier_info = TierInfo().get_module_by_name(f"Tier{site_tier}")
+        tier_info = TierInfo().get_module_by_name(f"tier{site_tier}")
         device_type = self.netbox.dcim.device_types.get(model=tier_info.device_type)
 
         # Get device role id
diff --git a/gso/utils/device_info.py b/gso/utils/device_info.py
index 669fb55aa..03b911f7c 100644
--- a/gso/utils/device_info.py
+++ b/gso/utils/device_info.py
@@ -18,14 +18,14 @@ class TierInfo:
 
     def __init__(self) -> None:
         """Initialise the different tiers of sites that exist."""
-        self.Tier1 = ModuleInfo(
+        self.tier1 = ModuleInfo(
             device_type="7750 SR-7s",
             module_bays_slots=[1, 2],
             module_type="XMA2-s-36p-400g",
             breakout_interfaces_per_slot=[36, 35, 34, 33],
             total_10g_interfaces=80,
         )
-        self.Tier2 = ModuleInfo(
+        self.tier2 = ModuleInfo(
             device_type="7750-SR7s",
             module_bays_slots=[1, 2],
             module_type="XMA2-s-36p-400g",
diff --git a/gso/workflows/iptrunk/migrate_iptrunk.py b/gso/workflows/iptrunk/migrate_iptrunk.py
index 24b036ba1..3ecba712d 100644
--- a/gso/workflows/iptrunk/migrate_iptrunk.py
+++ b/gso/workflows/iptrunk/migrate_iptrunk.py
@@ -40,6 +40,8 @@ from gso.utils.helpers import (
 
 logger = getLogger(__name__)
 
+PLAYBOOK_VERB_NOT_YET_PROPERLY_SET = "Playbook verb is not yet properly set."
+
 
 def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
     """Gather input from the operator on the new router that the IP trunk should connect to."""
@@ -250,7 +252,7 @@ def deploy_new_config_dry(
         "trunk_interface",
     )
 
-    logger.warning("Playbook verb is not yet properly set.")
+    logger.warning(PLAYBOOK_VERB_NOT_YET_PROPERLY_SET)
 
     return {
         "subscription": subscription,
@@ -286,7 +288,7 @@ def deploy_new_config_real(
         dry_run=False,
     )
 
-    logger.warning("Playbook verb is not yet properly set.")
+    logger.warning(PLAYBOOK_VERB_NOT_YET_PROPERLY_SET)
 
     return {
         "subscription": subscription,
@@ -337,7 +339,7 @@ def deploy_new_isis(
         dry_run=False,
     )
 
-    logger.warning("Playbook verb is not yet properly set.")
+    logger.warning(PLAYBOOK_VERB_NOT_YET_PROPERLY_SET)
 
     return {
         "subscription": subscription,
@@ -409,7 +411,7 @@ def delete_old_config_dry(
         "delete",
     )
 
-    logger.warning("Playbook verb is not yet properly set.")
+    logger.warning(PLAYBOOK_VERB_NOT_YET_PROPERLY_SET)
 
     return {"subscription": subscription}
 
@@ -443,7 +445,7 @@ def delete_old_config_real(
         dry_run=False,
     )
 
-    logger.warning("Playbook verb is not yet properly set.")
+    logger.warning(PLAYBOOK_VERB_NOT_YET_PROPERLY_SET)
 
     return {"subscription": subscription}
 
-- 
GitLab