From 1e810c08f5a680ee0473e706c5be263ee5592e91 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 8 Nov 2021 16:53:08 +0100 Subject: [PATCH] fix(ci): forcing no colour on grep commands Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 24 ++++++++++++------------ ci-scripts/cls_module_ue.py | 8 ++++---- ci-scripts/cls_oaicitest.py | 10 +++++----- ci-scripts/epc.py | 8 ++++---- ci-scripts/ran.py | 8 ++++---- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 03e3c03efa..f2b1665c54 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -222,7 +222,7 @@ class Containerize(): if (self.ranAllowMerge): imageTag = 'ci-temp' if self.ranTargetBranch == 'develop': - mySSH.command('git diff HEAD..origin/develop -- docker/Dockerfile.ran' + self.dockerfileprefix + ' | grep -i INDEX', '\$', 5) + mySSH.command('git diff HEAD..origin/develop -- docker/Dockerfile.ran' + self.dockerfileprefix + ' | grep --colour=never -i INDEX', '\$', 5) result = re.search('index', mySSH.getBefore()) if result is not None: forceSharedImageBuild = True @@ -901,17 +901,17 @@ class Containerize(): if svrName == 'porcepix': mySSH.open(ipAddr, userName, password) # Check if route to asterix gnb exists - mySSH.command('ip route | grep "192.168.68.64/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.68.64/26"', '\$', 10) result = re.search('192.168.18.194', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 192.168.18.194 dev eno1', '\$', 10) # Check if route to obelix enb exists - mySSH.command('ip route | grep "192.168.68.128/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) result = re.search('192.168.18.193', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 192.168.18.193 dev eno1', '\$', 10) # Check if route to nepes gnb exists - mySSH.command('ip route | grep "192.168.68.192/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.68.192/26"', '\$', 10) result = re.search('192.168.18.209', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 192.168.18.209 dev eno1', '\$', 10) @@ -929,17 +929,17 @@ class Containerize(): if svrName == 'asterix': mySSH.open(ipAddr, userName, password) # Check if route to porcepix epc exists - mySSH.command('ip route | grep "192.168.61.192/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) result = re.search('192.168.18.210', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 192.168.18.210 dev em1', '\$', 10) # Check if route to porcepix cn5g exists - mySSH.command('ip route | grep "192.168.70.128/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.70.128/26"', '\$', 10) result = re.search('192.168.18.210', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.70.128/26 via 192.168.18.210 dev em1', '\$', 10) # Check if X2 route to obelix enb exists - mySSH.command('ip route | grep "192.168.68.128/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) result = re.search('192.168.18.193', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 192.168.18.193 dev em1', '\$', 10) @@ -957,17 +957,17 @@ class Containerize(): if svrName == 'obelix': mySSH.open(ipAddr, userName, password) # Check if route to porcepix epc exists - mySSH.command('ip route | grep "192.168.61.192/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) result = re.search('192.168.18.210', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 192.168.18.210 dev eno1', '\$', 10) # Check if X2 route to asterix gnb exists - mySSH.command('ip route | grep "192.168.68.64/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.68.64/26"', '\$', 10) result = re.search('192.168.18.194', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.64/26 via 192.168.18.194 dev eno1', '\$', 10) # Check if X2 route to nepes gnb exists - mySSH.command('ip route | grep "192.168.68.192/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.68.192/26"', '\$', 10) result = re.search('192.168.18.209', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.192/26 via 192.168.18.209 dev eno1', '\$', 10) @@ -985,12 +985,12 @@ class Containerize(): if svrName == 'nepes': mySSH.open(ipAddr, userName, password) # Check if route to porcepix epc exists - mySSH.command('ip route | grep "192.168.61.192/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.61.192/26"', '\$', 10) result = re.search('192.168.18.210', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.61.192/26 via 192.168.18.210 dev enp0s31f6', '\$', 10) # Check if X2 route to obelix enb exists - mySSH.command('ip route | grep "192.168.68.128/26"', '\$', 10) + mySSH.command('ip route | grep --colour=never "192.168.68.128/26"', '\$', 10) result = re.search('192.168.18.193', mySSH.getBefore()) if result is None: mySSH.command('echo ' + password + ' | sudo -S ip route add 192.168.68.128/26 via 192.168.18.193 dev enp0s31f6', '\$', 10) diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py index 74ae9c207e..e006eb6aae 100644 --- a/ci-scripts/cls_module_ue.py +++ b/ci-scripts/cls_module_ue.py @@ -63,7 +63,7 @@ class Module_UE: #if not it will be started def CheckCMProcess(self,CNType): HOST=self.HostUsername+'@'+self.HostIPAddress - COMMAND="ps aux | grep " + self.Process['Name'] + " | grep -v grep " + COMMAND="ps aux | grep --colour=never " + self.Process['Name'] + " | grep -v grep " logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) result = ssh.stdout.readlines() @@ -81,7 +81,7 @@ class Module_UE: #checking the process time.sleep(5) HOST=self.HostUsername+'@'+self.HostIPAddress - COMMAND="ps aux | grep " + self.Process['Name'] + " | grep -v grep " + COMMAND="ps aux | grep --colour=never " + self.Process['Name'] + " | grep -v grep " logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) result = ssh.stdout.readlines() @@ -108,7 +108,7 @@ class Module_UE: response= [] tentative = 3 while (len(response)==0) and (tentative>0): - COMMAND="ip a show dev " + self.UENetwork + " | grep inet | grep " + self.UENetwork + COMMAND="ip a show dev " + self.UENetwork + " | grep --colour=never inet | grep " + self.UENetwork logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) response = ssh.stdout.readlines() @@ -136,7 +136,7 @@ class Module_UE: response= [] tentative = 3 while (len(response)==0) and (tentative>0): - COMMAND="ip a show dev " + self.UENetwork + " | grep mtu" + COMMAND="ip a show dev " + self.UENetwork + " | grep --colour=never mtu" logging.debug(COMMAND) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) response = ssh.stdout.readlines() diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 92a4e8637e..4684969471 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -192,16 +192,16 @@ class OaiCiTest(): result = re.search('LAST_BUILD_INFO', SSH.getBefore()) if result is not None: mismatch = False - SSH.command('grep SRC_COMMIT LAST_BUILD_INFO.txt', '\$', 2) + SSH.command('grep --colour=never SRC_COMMIT LAST_BUILD_INFO.txt', '\$', 2) result = re.search(self.ranCommitID, SSH.getBefore()) if result is None: mismatch = True - SSH.command('grep MERGED_W_TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) + SSH.command('grep --colour=never MERGED_W_TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) if self.ranAllowMerge: result = re.search('YES', SSH.getBefore()) if result is None: mismatch = True - SSH.command('grep TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) + SSH.command('grep --colour=never TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) if self.ranTargetBranch == '': result = re.search('develop', SSH.getBefore()) else: @@ -660,7 +660,7 @@ class OaiCiTest(): SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) count = 0 while count < 5: - SSH.command('echo ' + self.ADBPassword + ' | sudo -S lsof | grep ttyUSB0', '\$', 10) + SSH.command('echo ' + self.ADBPassword + ' | sudo -S lsof | grep --colour=never ttyUSB0', '\$', 10) result = re.search('picocom', SSH.getBefore()) if result is None: count = 10 @@ -1328,7 +1328,7 @@ class OaiCiTest(): SSH = sshconnection.SSHConnection() SSH.open(self.ADBIPAddress, self.ADBUserName, self.ADBPassword) if self.ADBCentralized: - SSH.command('lsusb | egrep "Future Technology Devices International, Ltd FT2232C" | sed -e "s#:.*##" -e "s# #_#g"', '\$', 15) + SSH.command('lsusb | egrep --colour=never "Future Technology Devices International, Ltd FT2232C" | sed -e "s#:.*##" -e "s# #_#g"', '\$', 15) #self.CatMDevices = re.findall("\\\\r\\\\n([A-Za-z0-9_]+)",SSH.getBefore()) self.CatMDevices = re.findall("\\\\r\\\\n([A-Za-z0-9_]+)",SSH.getBefore()) else: diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py index 6a7f838adc..5e6adce19c 100644 --- a/ci-scripts/epc.py +++ b/ci-scripts/epc.py @@ -404,7 +404,7 @@ class EPCManagement(): elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGINT oai_hss || true', '\$', 5) time.sleep(2) - mySSH.command('stdbuf -o0 ps -aux | grep hss | grep -v grep', '\$', 5) + mySSH.command('stdbuf -o0 ps -aux | grep --colour=never hss | grep -v grep', '\$', 5) result = re.search('oai_hss -j', mySSH.getBefore()) if result is not None: mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGKILL oai_hss || true', '\$', 5) @@ -412,7 +412,7 @@ class EPCManagement(): elif re.match('OAI', self.Type, re.IGNORECASE): mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGINT run_hss oai_hss || true', '\$', 5) time.sleep(2) - mySSH.command('stdbuf -o0 ps -aux | grep hss | grep -v grep', '\$', 5) + mySSH.command('stdbuf -o0 ps -aux | grep --colour=never hss | grep -v grep', '\$', 5) result = re.search('\/bin\/bash .\/run_', mySSH.getBefore()) if result is not None: mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGKILL run_hss oai_hss || true', '\$', 5) @@ -520,7 +520,7 @@ class EPCManagement(): mySSH.command('cd /opt/oai-cn5g-fed/docker-compose', '\$', 5) mySSH.command('./core-network.sh stop nrf spgwu', '\$', 60) time.sleep(2) - mySSH.command('tshark -r /tmp/oai-cn5g.pcap | egrep "Tracking area update" ','\$', 30) + mySSH.command('tshark -r /tmp/oai-cn5g.pcap | egrep --colour=never "Tracking area update" ','\$', 30) result = re.search('Tracking area update request', mySSH.getBefore()) if result is not None: message = 'UE requested ' + mySSH.getBefore().count('Tracking area update request') + 'Tracking area update request(s)' @@ -719,7 +719,7 @@ class EPCManagement(): mySSH.command('docker cp prod-magma-mme:/tmp/mme_check_run.pcap mme_' + self.testCase_id + '.pcap', '\$', 60) else: mySSH.command('docker cp prod-oai-mme:/tmp/mme_check_run.pcap mme_' + self.testCase_id + '.pcap', '\$', 60) - mySSH.command('tshark -r mme_' + self.testCase_id + '.pcap | egrep "Tracking area update"', '\$', 60) + mySSH.command('tshark -r mme_' + self.testCase_id + '.pcap | egrep --colour=never "Tracking area update"', '\$', 60) result = re.search('Tracking area update request', mySSH.getBefore()) if result is not None: message = 'UE requested ' + mySSH.getBefore().count('Tracking area update request') + 'Tracking area update request(s)' diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 9acb1de34e..7d8f055226 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -165,16 +165,16 @@ class RANManagement(): result = re.search('LAST_BUILD_INFO', mySSH.getBefore()) if result is not None: mismatch = False - mySSH.command('grep SRC_COMMIT LAST_BUILD_INFO.txt', '\$', 2) + mySSH.command('grep --colour=never SRC_COMMIT LAST_BUILD_INFO.txt', '\$', 2) result = re.search(self.ranCommitID, mySSH.getBefore()) if result is None: mismatch = True - mySSH.command('grep MERGED_W_TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) + mySSH.command('grep --colour=never MERGED_W_TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) if (self.ranAllowMerge): result = re.search('YES', mySSH.getBefore()) if result is None: mismatch = True - mySSH.command('grep TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) + mySSH.command('grep --colour=never TGT_BRANCH LAST_BUILD_INFO.txt', '\$', 2) if self.ranTargetBranch == '': result = re.search('develop', mySSH.getBefore()) else: @@ -446,7 +446,7 @@ class RANManagement(): else: mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED.*;/FLEXRAN_ENABLED = "no";/\' ' + ci_full_config_file, '\$', 2); self.eNBmbmsEnables[int(self.eNB_instance)] = False - mySSH.command('grep enable_enb_m2 ' + ci_full_config_file, '\$', 2); + mySSH.command('grep --colour=never enable_enb_m2 ' + ci_full_config_file, '\$', 2); result = re.search('yes', mySSH.getBefore()) if result is not None: self.eNBmbmsEnables[int(self.eNB_instance)] = True