Commit 2c07f008 authored by Robert Schmidt's avatar Robert Schmidt
Browse files

Merge branch 'ci-remove-unused-code' into 'develop' (!3058)

CI: remove unused code, clean up imports

* Remove pyshark, matplotlib imports, as they are not used
* Remove stats_monitor.py, as the CI does not use it
* Clean up many warnings shown by pyflakes regarding includes that we don't use
parents ec06c78b 670e1fb8
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -50,9 +50,9 @@ CN_CONTAINERS = ["", "-c nrf", "-c amf", "-c smf", "-c upf", "-c ausf", "-c udm"
def OC_login(cmd, ocUserName, ocPassword, ocProjectName):
	if ocUserName == '' or ocPassword == '' or ocProjectName == '':
		HELP.GenericHelp(CONST.Version)
		sys.exit('Insufficient Parameter: no OC Credentials')
		raise ValueError('Insufficient Parameter: no OC Credentials')
	if OCRegistry.startswith("http") or OCRegistry.endswith("/"):
		sys.exit(f'ocRegistry {OCRegistry} should not start with http:// or https:// and not end on a slash /')
		raise ValueError(f'ocRegistry {OCRegistry} should not start with http:// or https:// and not end on a slash /')
	ret = cmd.run(f'oc login -u {ocUserName} -p {ocPassword} --server {OCUrl}')
	if ret.returncode != 0:
		logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m')
@@ -244,7 +244,7 @@ class Cluster:
		if self.testSvrId == None: self.testSvrId = self.eNBIPAddress
		if self.imageToPull == '':
			HELP.GenericHelp(CONST.Version)
			sys.exit('Insufficient Parameter')
			raise ValueError('Insufficient Parameter')
		logging.debug(f'Pull OC image {self.imageToPull} to server {self.testSvrId}')
		self.testCase_id = HTML.testCase_id
		cmd = cls_cmd.getConnection(self.testSvrId)
@@ -282,19 +282,19 @@ class Cluster:
	def BuildClusterImage(self, HTML):
		if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
			HELP.GenericHelp(CONST.Version)
			sys.exit(f'Insufficient Parameter: ranRepository {self.ranRepository} ranBranch {ranBranch} ranCommitID {self.ranCommitID}')
			raise ValueError(f'Insufficient Parameter: ranRepository {self.ranRepository} ranBranch {ranBranch} ranCommitID {self.ranCommitID}')
		lIpAddr = self.eNBIPAddress
		lSourcePath = self.eNBSourceCodePath
		if lIpAddr == '' or lSourcePath == '':
			sys.exit('Insufficient Parameter: eNBSourceCodePath missing')
			raise ValueError('Insufficient Parameter: eNBSourceCodePath missing')
		ocUserName = self.OCUserName
		ocPassword = self.OCPassword
		ocProjectName = self.OCProjectName
		if ocUserName == '' or ocPassword == '' or ocProjectName == '':
			HELP.GenericHelp(CONST.Version)
			sys.exit('Insufficient Parameter: no OC Credentials')
			raise ValueError('Insufficient Parameter: no OC Credentials')
		if self.OCRegistry.startswith("http") or self.OCRegistry.endswith("/"):
			sys.exit(f'ocRegistry {self.OCRegistry} should not start with http:// or https:// and not end on a slash /')
			raise ValueError(f'ocRegistry {self.OCRegistry} should not start with http:// or https:// and not end on a slash /')

		logging.debug(f'Building on cluster triggered from server: {lIpAddr}')
		self.cmd = cls_cmd.RemoteCmd(lIpAddr)
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import subprocess as sp
import os
import paramiko
import uuid
import sys
import time

SSHTIMEOUT=7
+0 −6
Original line number Diff line number Diff line
@@ -36,18 +36,12 @@ import re # reg
import logging
import os
import shutil
import subprocess
import time
import pyshark
import threading
import cls_cmd
from multiprocessing import Process, Lock, SimpleQueue
from zipfile import ZipFile

#-----------------------------------------------------------
# OAI Testing modules
#-----------------------------------------------------------
import cls_cluster as OC
import cls_cmd
import sshconnection as SSH
import helpreadme as HELP
+0 −11
Original line number Diff line number Diff line
@@ -25,14 +25,10 @@
#---------------------------------------------------------------------

#to use isfile
import os
import sys
import logging
#time.sleep
import time
import re
import subprocess
from datetime import datetime
import yaml

import cls_cmd
@@ -208,13 +204,6 @@ class Module_UE:

	def _enableTrace(self):
		raise Exception("not implemented")
		mySSH = sshconnection.SSHConnection()
		mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
		#delete old artifacts
		mySSH.command('echo ' + ' '  + ' | sudo -S rm -rf ci_qlog','\$',5)
		#start Trace, artifact is created in home dir
		mySSH.command('echo $USER; nohup sudo -E QLog/QLog -s ci_qlog -f NR5G.cfg > /dev/null 2>&1 &','\$', 5)
		mySSH.close()

	def _disableTrace(self):
		raise Exception("not implemented")
+0 −2
Original line number Diff line number Diff line
@@ -31,14 +31,12 @@
#-----------------------------------------------------------
# Import
#-----------------------------------------------------------
import sys              # arg
import re               # reg
import fileinput
import logging
import os
import time
import subprocess
from multiprocessing import Process, Lock, SimpleQueue

import constants as CONST

Loading