[PATCH v2 02/11] Common: New module NetUtils

rpazdera at redhat.com rpazdera at redhat.com
Mon Aug 13 10:01:43 UTC 2012


From: Radek Pazdera <rpazdera at redhat.com>

Created a new module for networking related code and utilities
in Common package.

The normalize_hwaddr() function was moved there.

Signed-off-by: Radek Pazdera <rpazdera at redhat.com>
---
 Common/NetUtils.py             |   16 ++++++++++++++++
 NetConfig/NetConfigDevNames.py |    4 +---
 NetTest/NetTestParse.py        |    3 +--
 3 files changed, 18 insertions(+), 5 deletions(-)
 create mode 100644 Common/NetUtils.py

diff --git a/Common/NetUtils.py b/Common/NetUtils.py
new file mode 100644
index 0000000..059ce6e
--- /dev/null
+++ b/Common/NetUtils.py
@@ -0,0 +1,16 @@
+"""
+Networking related utilities and common code
+
+Copyright 2012 Red Hat, Inc.
+Licensed under the GNU General Public License, version 2 as
+published by the Free Software Foundation; see COPYING for details.
+"""
+
+__author__ = """
+rpazdera at redhat.com (Radek Pazdera)
+"""
+
+import logging
+
+def normalize_hwaddr(hwaddr):
+    return hwaddr.upper().rstrip("\n")
diff --git a/NetConfig/NetConfigDevNames.py b/NetConfig/NetConfigDevNames.py
index 1220480..7c7f862 100644
--- a/NetConfig/NetConfigDevNames.py
+++ b/NetConfig/NetConfigDevNames.py
@@ -13,9 +13,7 @@ jpirko at redhat.com (Jiri Pirko)
 import logging
 import os
 from NetConfigCommon import get_option
-
-def normalize_hwaddr(hwaddr):
-    return hwaddr.upper().rstrip("\n")
+from Common.NetUtils import normalize_hwaddr
 
 class NetConfigDevNames:
     def __init__(self):
diff --git a/NetTest/NetTestParse.py b/NetTest/NetTestParse.py
index 32d75e1..746342c 100644
--- a/NetTest/NetTestParse.py
+++ b/NetTest/NetTestParse.py
@@ -16,8 +16,7 @@ import re
 from Common.XmlProcessing import RecipeParser
 from Common.XmlProcessing import XmlDomTreeInit
 from Common.XmlProcessing import XmlProcessingError
-from NetConfig.NetConfigDevNames import normalize_hwaddr
-
+from Common.NetUtils import normalize_hwaddr
 
 class NetTestParse(RecipeParser):
     def __init__(self, recipe_filepath):
-- 
1.7.7.6



More information about the LNST-developers mailing list