VOL-1058: Test Case: Authentication (RADIUS)
Apply review comment changes
Change-Id: I72b8dc9ff1cd4bd1c3570c6a7b84d49a1f0de55a
diff --git a/tests/atests/common/testCaseUtils.py b/tests/atests/common/testCaseUtils.py
index ead244d..fe76687 100755
--- a/tests/atests/common/testCaseUtils.py
+++ b/tests/atests/common/testCaseUtils.py
@@ -105,7 +105,7 @@
for line in lines:
sys.stdout.write (line)
-def extractIpAddr(podName):
+def extractPodIpAddr(podName):
proc1 = subprocess.Popen(['/usr/bin/kubectl', 'get', 'svc', '--all-namespaces'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
@@ -121,6 +121,22 @@
out, err = proc3.communicate()
return out
+def extractRadiusIpAddr(podName):
+ proc1 = subprocess.Popen(['/usr/bin/kubectl', 'describe', 'pod', '-n', 'voltha', podName],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ proc2 = subprocess.Popen(['grep', '^IP:'], stdin=proc1.stdout,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ proc3 = subprocess.Popen(['awk', "{print $2}"], stdin=proc2.stdout,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+
+ proc1.stdout.close
+ proc2.stdout.close
+ out, err = proc3.communicate()
+ return out
+
def extractPodName(shortPodName):
proc1 = subprocess.Popen(['/usr/bin/kubectl', 'get', 'pods', '--all-namespaces'],
stdout=subprocess.PIPE,
@@ -137,4 +153,9 @@
proc2.stdout.close
out, err = proc3.communicate()
return out
+
+def modifyRadiusIpInJsonUsingSed(self, newIpAddr):
+ sedCommand ="sed -i '/radiusIp/c\ \"radiusIp\":\"'%s'\",' %s/tests/atests/build/aaa_json" % (newIpAddr, getDir(self, 'voltha'))
+ status = commands.getstatusoutput(sedCommand)[0]
+ return status