From a51190a7c57c8fc46616d0f85f8d8330137582ec Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 18 Nov 2024 08:51:24 +0100 Subject: [PATCH] CI: deploy Magme-MME OAI EPC through CoreNetwork, use in Ping/Iperf - call scripts for magma MME-based deployment of OAI 5GC in ci_infra.yaml - implement the existing python code through scripts (which does the same) - save the cql file in the repo, which was previously downloaded every time - use for porcepix-cn4g and nano-cn4g (un)deployment, ping, perf, in XML files --- ci-scripts/ci_infra.yaml | 6 + ci-scripts/epc.py | 322 +----------------- ci-scripts/scripts/magma-epc-deploy.sh | 28 ++ ci-scripts/scripts/magma-epc-logcollect.sh | 12 + ...container_lte_b200_fdd_10Mhz_tm1_oaiue.xml | 1 + .../container_lte_n3xx_tdd_2x2_tm1.xml | 2 + .../container_lte_n3xx_tdd_2x2_tm2.xml | 2 + ci-scripts/xml_files/fr1_oai_cn_deploy.xml | 6 +- ci-scripts/xml_files/fr1_oai_cn_undeploy.xml | 5 +- ci-scripts/xml_files/lte_oai_cn_deploy.xml | 6 +- ci-scripts/xml_files/lte_oai_cn_undeploy.xml | 5 +- .../yaml_files/magma_nsa_20897/oai_db.cql | 93 +++++ 12 files changed, 168 insertions(+), 320 deletions(-) create mode 100755 ci-scripts/scripts/magma-epc-deploy.sh create mode 100755 ci-scripts/scripts/magma-epc-logcollect.sh create mode 100644 ci-scripts/yaml_files/magma_nsa_20897/oai_db.cql diff --git a/ci-scripts/ci_infra.yaml b/ci-scripts/ci_infra.yaml index 261167aeaa..edb6078e4a 100644 --- a/ci-scripts/ci_infra.yaml +++ b/ci-scripts/ci_infra.yaml @@ -100,11 +100,17 @@ porcepix-cn4g: Host: porcepix NetworkScript: docker exec prod-trf-gen ip a show dev eth0 CmdPrefix: docker exec prod-trf-gen + Deploy: "! scripts/magma-epc-deploy.sh /opt/oai-epc-magma/docker-compose.yml" + Undeploy: "docker compose -f /opt/oai-epc-magma/docker-compose.yml down" + LogCollect: "! scripts/magma-epc-logcollect.sh %%log_dir%%" nano-cn4g: Host: nano NetworkScript: docker exec prod-trf-gen ip a show dev eth0 CmdPrefix: docker exec prod-trf-gen + Deploy: "! scripts/magma-epc-deploy.sh /opt/oai-epc-magma/docker-compose.yml" + Undeploy: "docker compose -f /opt/oai-epc-magma/docker-compose.yml down" + LogCollect: "! scripts/magma-epc-logcollect.sh %%log_dir%%" ltebox-nano: Host: nano diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py index 715f0848df..c095761cd0 100644 --- a/ci-scripts/epc.py +++ b/ci-scripts/epc.py @@ -90,12 +90,7 @@ class EPCManagement(): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - logging.debug('Using the OAI EPC Release 14 Cassandra-based HSS in Docker') - mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5) - mySSH.command('mkdir -p ' + self.SourceCodePath + '/scripts', '\$', 5) - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-hss /bin/bash -c "nohup tshark -i eth0 -i eth1 -w /tmp/hss_check_run.pcap 2>&1 > /dev/null"', '\$', 5) - time.sleep(5) - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-hss /bin/bash -c "nohup ./bin/oai_hss -j ./etc/hss_rel14.json --reloadkey true > hss_check_run.log 2>&1"', '\$', 5) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): raise NotImplemented("core network not supported") elif re.match('OAI', self.Type, re.IGNORECASE): @@ -116,10 +111,7 @@ class EPCManagement(): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - logging.debug('Using the OAI EPC Release 14 MME in Docker') - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-mme /bin/bash -c "nohup tshark -i eth0 -i lo:s10 -f "not port 2152" -w /tmp/mme_check_run.pcap 2>&1 > /dev/null"', '\$', 5) - time.sleep(5) - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-mme /bin/bash -c "nohup ./bin/oai_mme -c ./etc/' + self.mmeConfFile + ' > mme_check_run.log 2>&1"', '\$', 5) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): raise NotImplemented("core network not supported") elif re.match('OAI', self.Type, re.IGNORECASE): @@ -140,22 +132,7 @@ class EPCManagement(): return # Only in case of Docker containers, MME IP address is not the EPC HOST IP address if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH = SSH.SSHConnection() - mySSH.open(self.IPAddress, self.UserName, self.Password) - self.isMagmaUsed = False - mySSH.command('docker ps -a', '\$', 5) - result = re.search('magma', mySSH.getBefore()) - if result is not None: - self.isMagmaUsed = True - if self.isMagmaUsed: - mySSH.command('docker inspect --format="MME_IP_ADDR = {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" ' + self.containerPrefix + '-magma-mme', '\$', 5) - else: - mySSH.command('docker inspect --format="MME_IP_ADDR = {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" ' + self.containerPrefix + '-oai-mme', '\$', 5) - result = re.search('MME_IP_ADDR = (?P[0-9\.]+)', mySSH.getBefore()) - if result is not None: - self.MmeIPAddress = result.group('mme_ip_addr') - logging.debug('MME IP Address is ' + self.MmeIPAddress) - mySSH.close() + raise NotImplemented("use cls_corenetwork.py") else: self.MmeIPAddress = self.IPAddress @@ -167,13 +144,7 @@ class EPCManagement(): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - logging.debug('Using the OAI EPC Release 14 SPGW-CUPS in Docker') - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "nohup tshark -i eth0 -i lo:p5c -i lo:s5c -f "not port 2152" -w /tmp/spgwc_check_run.pcap 2>&1 > /dev/null"', '\$', 5) - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "nohup tshark -i eth0 -f "not port 2152" -w /tmp/spgwu_check_run.pcap 2>&1 > /dev/null"', '\$', 5) - time.sleep(5) - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "nohup ./bin/oai_spgwc -o -c ./etc/spgw_c.conf > spgwc_check_run.log 2>&1"', '\$', 5) - time.sleep(5) - mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "nohup ./bin/oai_spgwu -o -c ./etc/spgw_u.conf > spgwu_check_run.log 2>&1"', '\$', 5) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): raise NotImplemented("core network not supported") elif re.match('OAI', self.Type, re.IGNORECASE): @@ -223,12 +194,7 @@ class EPCManagement(): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "killall --signal SIGINT oai_hss tshark"', '\$', 5) - time.sleep(2) - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "ps aux | grep oai_hss"', '\$', 5) - result = re.search('oai_hss -j ', mySSH.getBefore()) - if result is not None: - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "killall --signal SIGKILL oai_hss"', '\$', 5) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): raise NotImplemented("core network not supported") elif re.match('OAI', self.Type, re.IGNORECASE): @@ -245,12 +211,7 @@ class EPCManagement(): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "killall --signal SIGINT oai_mme tshark"', '\$', 5) - time.sleep(2) - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "ps aux | grep oai_mme"', '\$', 5) - result = re.search('oai_mme -c ', mySSH.getBefore()) - if result is not None: - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "killall --signal SIGKILL oai_mme"', '\$', 5) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): raise NotImplemented("core network not supported") elif re.match('ltebox', self.Type, re.IGNORECASE): @@ -265,17 +226,7 @@ class EPCManagement(): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "killall --signal SIGINT oai_spgwc tshark"', '\$', 5) - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "killall --signal SIGINT oai_spgwu tshark"', '\$', 5) - time.sleep(2) - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "ps aux | grep oai_spgwc"', '\$', 5) - result = re.search('oai_spgwc -o -c ', mySSH.getBefore()) - if result is not None: - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "killall --signal SIGKILL oai_spgwc"', '\$', 5) - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "ps aux | grep oai_spgwu"', '\$', 5) - result = re.search('oai_spgwu -o -c ', mySSH.getBefore()) - if result is not None: - mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwu-tiny /bin/bash -c "killall --signal SIGKILL oai_spgwu"', '\$', 5) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): raise NotImplemented("core network not supported") elif re.match('OAI', self.Type, re.IGNORECASE): @@ -304,227 +255,10 @@ class EPCManagement(): return True def DeployEpc(self, HTML): - logging.debug('Trying to deploy') - if not re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) - HTML.CreateHtmlTabFooter(False) - logging.error('Deploy not possible with this EPC type: ' + self.Type) - return False - - if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '': - HELP.GenericHelp(CONST.Version) - HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type) - logging.error('Insufficient EPC Parameters') - return False - mySSH = SSH.SSHConnection() - mySSH.open(self.IPAddress, self.UserName, self.Password) - mySSH.command('docker-compose --version', '\$', 5) - result = re.search('docker-compose version 1|Docker Compose version v2', mySSH.getBefore()) - if result is None: - mySSH.close() - HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) - HTML.CreateHtmlTabFooter(False) - logging.error('docker-compose not installed on ' + self.IPAddress) - return False - - # Checking if it is a MAGMA deployment - self.isMagmaUsed = False - if os.path.isfile('./' + self.yamlPath + '/redis_extern.conf'): - self.isMagmaUsed = True - logging.debug('MAGMA MME is used!') - - mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5) - mySSH.command('if [ -d ' + self.SourceCodePath + '/logs ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/logs ; fi', '\$', 5) - mySSH.command('mkdir -p ' + self.SourceCodePath + '/scripts ' + self.SourceCodePath + '/logs', '\$', 5) - mySSH.command('rm -f ' + self.SourceCodePath + '/*.log', '\$', 5) - - # deploying and configuring the cassandra database - # container names and services are currently hard-coded. - # they could be recovered by: - # - docker-compose config --services - # - docker-compose config | grep container_name - mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) - mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/docker-compose.yml', self.SourceCodePath + '/scripts') - if self.isMagmaUsed: - mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/entrypoint.sh', self.SourceCodePath + '/scripts') - mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/mme.conf', self.SourceCodePath + '/scripts') - mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/mme_fd.sprint.conf', self.SourceCodePath + '/scripts') - mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/redis_extern.conf', self.SourceCodePath + '/scripts') - mySSH.command('chmod a+x ' + self.SourceCodePath + '/scripts/entrypoint.sh', '\$', 5) - else: - mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/entrypoint.sh', self.SourceCodePath + '/scripts') - mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/mme.conf', self.SourceCodePath + '/scripts') - mySSH.command('chmod 775 entrypoint.sh', '\$', 60) - mySSH.command('wget --quiet --tries=3 --retry-connrefused https://raw.githubusercontent.com/OPENAIRINTERFACE/openair-hss/develop/src/hss_rel14/db/oai_db.cql', '\$', 30) - mySSH.command('docker-compose down -v', '\$', 60) - mySSH.command('docker-compose up -d db_init', '\$', 60) - # databases take time... - time.sleep(10) - cnt = 0 - db_init_status = False - while (cnt < 10): - mySSH.command('docker logs prod-db-init', '\$', 5) - result = re.search('OK', mySSH.getBefore()) - if result is not None: - cnt = 10 - db_init_status = True - else: - time.sleep(5) - cnt += 1 - mySSH.command('docker rm -f prod-db-init', '\$', 5) - if not db_init_status: - HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) - HTML.CreateHtmlTabFooter(False) - logging.error('Cassandra DB deployment/configuration went wrong!') - return True - - # deploying EPC cNFs - mySSH.command('docker-compose up -d oai_spgwu', '\$', 60) - if self.isMagmaUsed: - listOfContainers = 'prod-cassandra prod-oai-hss prod-magma-mme prod-oai-spgwc prod-oai-spgwu-tiny prod-redis' - expectedHealthyContainers = 6 - else: - listOfContainers = 'prod-cassandra prod-oai-hss prod-oai-mme prod-oai-spgwc prod-oai-spgwu-tiny' - expectedHealthyContainers = 5 - - # Checking for additional services - mySSH.command('docker-compose config', '\$', 5) - configResponse = mySSH.getBefore() - if configResponse.count('trf_gen') == 1: - mySSH.command('docker-compose up -d trf_gen', '\$', 60) - listOfContainers += ' prod-trf-gen' - expectedHealthyContainers += 1 - - mySSH.command('docker-compose config | grep --colour=never image', '\$', 10) - html_cell = '' - listOfImages = mySSH.getBefore() - for imageLine in listOfImages.split('\\r\\n'): - res1 = re.search('image: (?P[a-zA-Z0-9\-]+):(?P[a-zA-Z0-9\-]+)', str(imageLine)) - res2 = re.search('cassandra|redis', str(imageLine)) - if res1 is not None and res2 is None: - html_cell += res1.group('name') + ':' + res1.group('tag') + ' ' - nbChars = len(res1.group('name')) + len(res1.group('tag')) + 2 - while (nbChars < 32): - html_cell += ' ' - nbChars += 1 - mySSH.command('docker image inspect --format="Size = {{.Size}} bytes" ' + res1.group('name') + ':' + res1.group('tag'), '\$', 10) - res3 = re.search('Size *= *(?P[0-9\-]*) *bytes', mySSH.getBefore()) - if res3 is not None: - imageSize = int(res3.group('size')) - imageSize = int(imageSize/(1024*1024)) - html_cell += str(imageSize) + ' MBytes ' - mySSH.command('docker image inspect --format="Date = {{.Created}}" ' + res1.group('name') + ':' + res1.group('tag'), '\$', 10) - res4 = re.search('Date *= *(?P[0-9\-]*)T', mySSH.getBefore()) - if res4 is not None: - html_cell += '(' + res4.group('date') + ')' - html_cell += '\n' - # Checking if all are healthy - cnt = 0 - while (cnt < 3): - mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' ' + listOfContainers, '\$', 10) - unhealthyNb = mySSH.getBefore().count('unhealthy') - healthyNb = mySSH.getBefore().count('healthy') - unhealthyNb - startingNb = mySSH.getBefore().count('starting') - if healthyNb == expectedHealthyContainers: - cnt = 10 - else: - time.sleep(10) - cnt += 1 - logging.debug(' -- ' + str(healthyNb) + ' healthy container(s)') - logging.debug(' -- ' + str(unhealthyNb) + ' unhealthy container(s)') - logging.debug(' -- ' + str(startingNb) + ' still starting container(s)') - if healthyNb == expectedHealthyContainers: - mySSH.command('docker exec -d prod-oai-hss /bin/bash -c "nohup tshark -i any -f \'port 9042 or port 3868\' -w /tmp/hss_check_run.pcap 2>&1 > /dev/null"', '\$', 5) - if self.isMagmaUsed: - mySSH.command('docker exec -d prod-magma-mme /bin/bash -c "nohup tshark -i any -f \'port 3868 or port 2123 or port 36412\' -w /tmp/mme_check_run.pcap 2>&1 > /dev/null"', '\$', 10) - else: - mySSH.command('docker exec -d prod-oai-mme /bin/bash -c "nohup tshark -i any -f \'port 3868 or port 2123 or port 36412\' -w /tmp/mme_check_run.pcap 2>&1 > /dev/null"', '\$', 10) - mySSH.command('docker exec -d prod-oai-spgwc /bin/bash -c "nohup tshark -i any -f \'port 2123 or port 8805\' -w /tmp/spgwc_check_run.pcap 2>&1 > /dev/null"', '\$', 10) - # on SPGW-U, not capturing on SGI to avoid huge file - mySSH.command('docker exec -d prod-oai-spgwu-tiny /bin/bash -c "nohup tshark -i any -f \'port 8805\' -w /tmp/spgwu_check_run.pcap 2>&1 > /dev/null"', '\$', 10) - mySSH.close() - logging.debug('Deployment OK') - HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [html_cell]) - return True - else: - mySSH.close() - logging.debug('Deployment went wrong') - HTML.CreateHtmlTestRowQueue(self.Type, 'KO', [html_cell]) - return False + raise NotImplemented("use cls_corenetwork.py") def UndeployEpc(self, HTML): - logging.debug('Trying to undeploy') - # No check down, we suppose everything done before. - - mySSH = SSH.SSHConnection() - mySSH.open(self.IPAddress, self.UserName, self.Password) - # Checking if it is a MAGMA deployment. - mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) - mySSH.command('docker-compose ps -a', '\$', 5) - self.isMagmaUsed = False - result = re.search('magma', mySSH.getBefore()) - if result is not None: - self.isMagmaUsed = True - logging.debug('MAGMA MME is used!') - # Recovering logs and pcap files - mySSH.command('cd ' + self.SourceCodePath + '/logs', '\$', 5) - mySSH.command('docker exec -it prod-oai-hss /bin/bash -c "killall --signal SIGINT oai_hss tshark"', '\$', 5) - if self.isMagmaUsed: - mySSH.command('docker exec -it prod-magma-mme /bin/bash -c "killall --signal SIGINT tshark"', '\$', 5) - else: - mySSH.command('docker exec -it prod-oai-mme /bin/bash -c "killall --signal SIGINT tshark"', '\$', 5) - mySSH.command('docker exec -it prod-oai-spgwc /bin/bash -c "killall --signal SIGINT oai_spgwc tshark"', '\$', 5) - mySSH.command('docker exec -it prod-oai-spgwu-tiny /bin/bash -c "killall --signal SIGINT tshark"', '\$', 5) - mySSH.command('docker logs prod-oai-hss > hss_' + self.testCase_id + '.log', '\$', 5) - if self.isMagmaUsed: - mySSH.command('docker cp --follow-link prod-magma-mme:/var/log/mme.log mme_' + self.testCase_id + '.log', '\$', 15) - else: - mySSH.command('docker logs prod-oai-mme > mme_' + self.testCase_id + '.log', '\$', 5) - mySSH.command('docker logs prod-oai-spgwc > spgwc_' + self.testCase_id + '.log', '\$', 5) - mySSH.command('docker logs prod-oai-spgwu-tiny > spgwu_' + self.testCase_id + '.log', '\$', 5) - mySSH.command('docker cp prod-oai-hss:/tmp/hss_check_run.pcap hss_' + self.testCase_id + '.pcap', '\$', 60) - if self.isMagmaUsed: - 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 | grep -E --colour=never "Tracking area update"', '\$', 60) - result = re.search('Tracking area update request', mySSH.getBefore()) - if result is not None: - message = 'UE requested ' + str(mySSH.getBefore().count('Tracking area update request')) + 'Tracking area update request(s)' - else: - message = 'No Tracking area update request' - logging.debug(message) - mySSH.command('docker cp prod-oai-spgwc:/tmp/spgwc_check_run.pcap spgwc_' + self.testCase_id + '.pcap', '\$', 60) - mySSH.command('docker cp prod-oai-spgwu-tiny:/tmp/spgwu_check_run.pcap spgwu_' + self.testCase_id + '.pcap', '\$', 60) - # Remove all - mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) - if self.isMagmaUsed: - listOfContainers = 'prod-cassandra prod-oai-hss prod-magma-mme prod-oai-spgwc prod-oai-spgwu-tiny prod-redis' - nbContainers = 6 - else: - listOfContainers = 'prod-cassandra prod-oai-hss prod-oai-mme prod-oai-spgwc prod-oai-spgwu-tiny' - nbContainers = 5 - # Checking for additional services - mySSH.command('docker-compose config', '\$', 5) - configResponse = mySSH.getBefore() - if configResponse.count('trf_gen') == 1: - listOfContainers += ' prod-trf-gen' - nbContainers += 1 - - mySSH.command('docker-compose down -v', '\$', 60) - mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' ' + listOfContainers, '\$', 10) - noMoreContainerNb = mySSH.getBefore().count('No such object') - mySSH.command('docker inspect --format=\'{{.Name}}\' prod-oai-public-net prod-oai-private-net', '\$', 10) - noMoreNetworkNb = mySSH.getBefore().count('No such object') - mySSH.close() - if noMoreContainerNb == nbContainers and noMoreNetworkNb == 2: - logging.debug('Undeployment OK') - HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [message]) - return True - else: - logging.debug('Undeployment went wrong') - HTML.CreateHtmlTestRowQueue(self.Type, 'KO', [message]) - return False + raise NotImplemented("use cls_corenetwork.py") def LogCollectHSS(self): mySSH = SSH.SSHConnection() @@ -532,17 +266,7 @@ class EPCManagement(): mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f hss.log.zip', '\$', 5) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH.command('docker inspect prod-oai-hss', '\$', 10) - result = re.search('No such object', mySSH.getBefore()) - if result is not None: - mySSH.command('cd ../logs', '\$', 5) - mySSH.command('rm -f hss.log.zip', '\$', 5) - mySSH.command('zip hss.log.zip hss_*.*', '\$', 60) - mySSH.command('mv hss.log.zip ../scripts', '\$', 60) - else: - mySSH.command('docker cp ' + self.containerPrefix + '-oai-hss:/openair-hss/hss_check_run.log .', '\$', 60) - mySSH.command('docker cp ' + self.containerPrefix + '-oai-hss:/tmp/hss_check_run.pcap .', '\$', 60) - mySSH.command('zip hss.log.zip hss_check_run.*', '\$', 60) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAICN5G', self.Type, re.IGNORECASE): raise NotImplemented("use cls_corenetwork.py") elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): @@ -564,17 +288,7 @@ class EPCManagement(): else: mySSH = cls_cmd.getConnection(self.IPAddress) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH.command('docker inspect prod-oai-mme', '\$', 10) - result = re.search('No such object', mySSH.getBefore()) - if result is not None: - mySSH.command('cd ../logs', '\$', 5) - mySSH.command('rm -f mme.log.zip', '\$', 5) - mySSH.command('zip mme.log.zip mme_*.*', '\$', 60) - mySSH.command('mv mme.log.zip ../scripts', '\$', 60) - else: - mySSH.command('docker cp ' + self.containerPrefix + '-oai-mme:/openair-mme/mme_check_run.log .', '\$', 60) - mySSH.command('docker cp ' + self.containerPrefix + '-oai-mme:/tmp/mme_check_run.pcap .', '\$', 60) - mySSH.command('zip mme.log.zip mme_check_run.*', '\$', 60) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAICN5G', self.Type, re.IGNORECASE): raise NotImplemented("use cls_corenetwork.py") elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): @@ -593,19 +307,7 @@ class EPCManagement(): mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('rm -f spgw.log.zip', '\$', 5) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): - mySSH.command('docker inspect prod-oai-mme', '\$', 10) - result = re.search('No such object', mySSH.getBefore()) - if result is not None: - mySSH.command('cd ../logs', '\$', 5) - mySSH.command('rm -f spgw.log.zip', '\$', 5) - mySSH.command('zip spgw.log.zip spgw*.*', '\$', 60) - mySSH.command('mv spgw.log.zip ../scripts', '\$', 60) - else: - mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwc:/openair-spgwc/spgwc_check_run.log .', '\$', 60) - mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwu-tiny:/openair-spgwu-tiny/spgwu_check_run.log .', '\$', 60) - mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwc:/tmp/spgwc_check_run.pcap .', '\$', 60) - mySSH.command('docker cp ' + self.containerPrefix + '-oai-spgwu-tiny:/tmp/spgwu_check_run.pcap .', '\$', 60) - mySSH.command('zip spgw.log.zip spgw*_check_run.*', '\$', 60) + raise NotImplemented("use cls_corenetwork.py") elif re.match('OAICN5G', self.Type, re.IGNORECASE): raise NotImplemented("use cls_corenetwork.py") elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): diff --git a/ci-scripts/scripts/magma-epc-deploy.sh b/ci-scripts/scripts/magma-epc-deploy.sh new file mode 100755 index 0000000000..dd0459ed29 --- /dev/null +++ b/ci-scripts/scripts/magma-epc-deploy.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +function die() { echo "${@}"; exit 1; } + +[ $# -eq 1 ] || die "usage: $0 " + +DOCKERFILE="${1}" + +function wait_for() { + local timeout=${1} + local condition=${2} + echo "wait up to ${timeout} seconds for condition \"${condition}\"" + while [ $timeout -gt 0 ]; do + eval ${condition} && return + sleep 1 + let timeout=$timeout-1 + done + die "ERROR: timed out waiting for condition \"${condition}\"" +} + +# start database +docker compose -f ${DOCKERFILE} up -d db_init cassandra +wait_for 30 "docker logs prod-db-init 2> /dev/null | grep OK" + +# start EPC +docker compose -f ${DOCKERFILE} up -d oai_hss redis magma_mme oai_spgwc oai_spgwu trf_gen +wait_for 20 "docker inspect --format='{{.State.Health.Status}}' prod-cassandra prod-oai-hss prod-magma-mme prod-oai-spgwc prod-oai-spgwu-tiny prod-redis prod-trf-gen | grep healthy | wc -l | grep 7" +echo "deployment OK" diff --git a/ci-scripts/scripts/magma-epc-logcollect.sh b/ci-scripts/scripts/magma-epc-logcollect.sh new file mode 100755 index 0000000000..d840b094f3 --- /dev/null +++ b/ci-scripts/scripts/magma-epc-logcollect.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +function die() { echo "${@}"; exit 1; } + +[ $# -eq 1 ] || die "usage: $0 " + +DIR=${1} + +docker logs prod-oai-hss &> ${DIR}/oai-hss.log +docker logs prod-magma-mme &> ${DIR}/magme-mme.log +docker logs prod-oai-spgwc &> ${DIR}/oai-spgwc.log +docker logs prod-oai-spgwu-tiny &> ${DIR}/oai-spgwu.log diff --git a/ci-scripts/xml_files/container_lte_b200_fdd_10Mhz_tm1_oaiue.xml b/ci-scripts/xml_files/container_lte_b200_fdd_10Mhz_tm1_oaiue.xml index f978d14cf9..5a04dff1fc 100644 --- a/ci-scripts/xml_files/container_lte_b200_fdd_10Mhz_tm1_oaiue.xml +++ b/ci-scripts/xml_files/container_lte_b200_fdd_10Mhz_tm1_oaiue.xml @@ -147,6 +147,7 @@ -c 20 192.168.61.200 5 lte_oai_ue_carabe + nano-cn4g diff --git a/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm1.xml b/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm1.xml index 5234e2d35c..511f5a0e9c 100644 --- a/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm1.xml +++ b/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm1.xml @@ -95,6 +95,7 @@ Ping Ping: 20 pings up2 + porcepix-cn4g -c 20 %cn_ip% 1 60 @@ -104,6 +105,7 @@ Ping Ping: 100 pings, size 1024 up2 + porcepix-cn4g -c 100 -s 1024 -i 0.2 %cn_ip% 1 60 diff --git a/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm2.xml b/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm2.xml index a02d0c48ef..0c85c4f028 100644 --- a/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm2.xml +++ b/ci-scripts/xml_files/container_lte_n3xx_tdd_2x2_tm2.xml @@ -95,6 +95,7 @@ Ping Ping: 20 pings up2 + porcepix-cn4g -c 20 %cn_ip% 1 60 @@ -104,6 +105,7 @@ Ping Ping: 100 pings, size 1024 up2 + porcepix-cn4g -c 100 -s 1024 -i 0.2 %cn_ip% 1 60 diff --git a/ci-scripts/xml_files/fr1_oai_cn_deploy.xml b/ci-scripts/xml_files/fr1_oai_cn_deploy.xml index 26dbebc329..9cfec6ef58 100644 --- a/ci-scripts/xml_files/fr1_oai_cn_deploy.xml +++ b/ci-scripts/xml_files/fr1_oai_cn_deploy.xml @@ -31,9 +31,9 @@ - Deploy_EPC - Deploy all EPC containers - yaml_files/magma_nsa_20897 + DeployCoreNetwork + Deploy EPC + porcepix-cn4g diff --git a/ci-scripts/xml_files/fr1_oai_cn_undeploy.xml b/ci-scripts/xml_files/fr1_oai_cn_undeploy.xml index 76192efea1..1be07ec180 100644 --- a/ci-scripts/xml_files/fr1_oai_cn_undeploy.xml +++ b/ci-scripts/xml_files/fr1_oai_cn_undeploy.xml @@ -31,8 +31,9 @@ - Undeploy_EPC - Undeploy all EPC containers + UndeployCoreNetwork + Undeploy EPC + porcepix-cn4g diff --git a/ci-scripts/xml_files/lte_oai_cn_deploy.xml b/ci-scripts/xml_files/lte_oai_cn_deploy.xml index 0279c1f3b3..3e4ea86e61 100644 --- a/ci-scripts/xml_files/lte_oai_cn_deploy.xml +++ b/ci-scripts/xml_files/lte_oai_cn_deploy.xml @@ -31,9 +31,9 @@ - Deploy_EPC - Deploy all EPC containers - yaml_files/magma_lte_20892 + DeployCoreNetwork + Deploy EPC + nano-cn4g diff --git a/ci-scripts/xml_files/lte_oai_cn_undeploy.xml b/ci-scripts/xml_files/lte_oai_cn_undeploy.xml index 76192efea1..b81aa01a1f 100644 --- a/ci-scripts/xml_files/lte_oai_cn_undeploy.xml +++ b/ci-scripts/xml_files/lte_oai_cn_undeploy.xml @@ -31,8 +31,9 @@ - Undeploy_EPC - Undeploy all EPC containers + UndeployCoreNetwork + Undeploy EPC + nano-cn4g diff --git a/ci-scripts/yaml_files/magma_nsa_20897/oai_db.cql b/ci-scripts/yaml_files/magma_nsa_20897/oai_db.cql new file mode 100644 index 0000000000..2be0a8e2e9 --- /dev/null +++ b/ci-scripts/yaml_files/magma_nsa_20897/oai_db.cql @@ -0,0 +1,93 @@ +CREATE KEYSPACE IF NOT EXISTS vhss WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '1'}; + +CREATE TABLE IF NOT EXISTS vhss.users_imsi ( + imsi text PRIMARY KEY, + access_restriction int, + idmmeidentity int, + imei text, + imei_sv text, + key text, + lipa_permissions text, + mme_cap int, + mmehost text, + mmeidentity_idmmeidentity int, + mmerealm text, + ms_ps_status text, + msisdn bigint, + niddvalidity text, + nir_dest_host text, + nir_dest_realm text, + opc text, + pgw_id int, + rand text, + rfsp_index varint, + sqn bigint, + subscription_data text, + ue_reachability varint, + urrp_mme varint, + user_identifier text, + visited_plmnid text); + +CREATE TABLE IF NOT EXISTS vhss.msisdn_imsi ( + msisdn bigint PRIMARY KEY, + imsi text +); + +CREATE TABLE IF NOT EXISTS vhss.global_ids ( + table_name text PRIMARY KEY, + id counter); + +CREATE TABLE IF NOT EXISTS vhss.mmeidentity_host ( + mmehost text PRIMARY KEY, + idmmeidentity int, + mmerealm text, + ue_reachability varint, + mmeisdn text); + +CREATE TABLE IF NOT EXISTS vhss.mmeidentity ( + idmmeidentity int PRIMARY KEY, + mmehost text, + mmerealm text, + ue_reachability varint, + mmeisdn text); + +CREATE TABLE IF NOT EXISTS vhss.events ( + scef_id text, + scef_ref_id bigint, + extid text, + monitoring_event_configuration text, + monitoring_type int, + msisdn bigint, + user_identifier text, + primary key (scef_id, scef_ref_id) +); + +CREATE TABLE IF NOT EXISTS vhss.events_msisdn ( + msisdn bigint, + scef_id text, + scef_ref_id bigint, + primary key (msisdn, scef_id, scef_ref_id) +); + +CREATE TABLE IF NOT EXISTS vhss.events_extid ( + extid text, + scef_id text, + scef_ref_id bigint, + primary key (extid, scef_id, scef_ref_id) +); + +CREATE TABLE IF NOT EXISTS vhss.extid ( + extid text primary key +); + +CREATE TABLE IF NOT EXISTS vhss.extid_imsi ( + extid text, + imsi text, + primary key (extid, imsi) +); + +CREATE TABLE IF NOT EXISTS vhss.extid_imsi_xref ( + imsi text, + extid text, + primary key (imsi, extid) +);