diff --git a/ci-scripts/checkUePduSession.py b/ci-scripts/checkUePduSession.py new file mode 100755 index 0000000000000000000000000000000000000000..fcf1e4f80ac1879c1796b8ab1cf2f5160dae809e --- /dev/null +++ b/ci-scripts/checkUePduSession.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +""" +Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The OpenAirInterface Software Alliance licenses this file to You under +the OAI Public License, Version 1.1 (the "License"); you may not use this file +except in compliance with the License. +You may obtain a copy of the License at + + http://www.openairinterface.org/?page_id=698 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +------------------------------------------------------------------------------ +For more information about the OpenAirInterface (OAI) Software Alliance: + contact@openairinterface.org +--------------------------------------------------------------------- +""" + +import argparse +import logging +import re +import sys +import time +import common.python.cls_cmd as cls_cmd + +logging.basicConfig( + level=logging.DEBUG, + stream=sys.stdout, + format="[%(asctime)s] %(levelname)8s: %(message)s" +) + +def _parse_args() -> argparse.Namespace: + """Parse the command line args + + Returns: + argparse.Namespace: the created parser + """ + example_text = '''example: + ./ci-scripts/checkContainerStatus.py --help + ./ci-scripts/checkContainerStatus.py --container_name NameOfContainer --max_tries MaxNumberOfAttachTries''' + + parser = argparse.ArgumentParser(description='OAI 5G CORE NETWORK Utility tool', + epilog=example_text, + formatter_class=argparse.RawDescriptionHelpFormatter) + + # Container Name + parser.add_argument( + '--container_name', '-n', + action='store', + help='Name of Container to follow', + ) + + # Time out in seconds + parser.add_argument( + '--max_tries', '-t', + action='store', + type=int, + default=3, + help='Maximum number of UE Attachments Tries', + ) + return parser.parse_args() + +if __name__ == '__main__': + # Parse the arguments + args = _parse_args() + + myCmds = cls_cmd.LocalCmd() + doLoop = True + status = -1 + count = 0 + while doLoop: + if args.container_name == 'rfsim5g-oai-nr-ue1': + time.sleep(20) + res = myCmds.run('docker exec rfsim5g-oai-nr-ue1 ifconfig oaitun_ue1') + if res.returncode == 0: + if re.search('inet 12', res.stdout) is not None: + status = 0 + break + if count == args.max_tries: + break + myCmds.run('docker stop rfsim5g-oai-nr-ue1') + time.sleep(5) + myCmds.run('docker restart rfsim5g-oai-nr-ue1') + time.sleep(10) + count += 1 + else: + status = 0 + break + + myCmds.close() + sys.exit(status) diff --git a/docs/DEPLOY_SA5G_SLICING.md b/docs/DEPLOY_SA5G_SLICING.md index 58bf4e0c8e4e89b64d51d829c7c8ebcbdae95a53..3ed0596b556b3325b0df89b36274dc3c518e6fe9 100644 --- a/docs/DEPLOY_SA5G_SLICING.md +++ b/docs/DEPLOY_SA5G_SLICING.md @@ -220,9 +220,10 @@ Creating rfsim5g-oai-nr-ue1 ... done ``` Wait a bit (5 to 10 seconds). <!--- -For CI purposes please ignore this line +For CI purposes please ignore these lines ``` shell docker-compose-host $: ../ci-scripts/checkContainerStatus.py --container_name rfsim5g-oai-nr-ue1 --timeout 30 +docker-compose-host $: ../ci-scripts/checkUePduSession.py --container_name rfsim5g-oai-nr-ue1 ``` --> Deploy ran simulator for slice 3 @@ -277,7 +278,7 @@ In this section we perform traffic test between oai-ext-dn node and UEs <br/> ``` shell docker-compose-host $: docker logs gnbsim 2>&1 | tail -10 -docker-compose-host $: docker logs oai-amf 2>&1 | tail -20 +docker-compose-host $: docker logs oai-amf 2>&1 | grep --color=never info | tail -20 docker-compose-host $: docker exec oai-ext-dn ping -c 4 12.1.1.2 PING 12.1.1.2 (12.1.1.2) 56(84) bytes of data. 64 bytes from 12.1.1.2: icmp_seq=2 ttl=63 time=0.346 ms @@ -299,16 +300,16 @@ PING 12.2.1.2 (12.2.1.2) 56(84) bytes of data. 4 packets transmitted, 4 received, 0% packet loss, time 3039ms rtt min/avg/max/mdev = 0.390/0.635/1.004/0.232 ms -docker-compose-host $: docker exec oai-ext-dn ping -c 4 12.1.1.130 -PING 12.1.1.130 (12.1.1.130) 56(84) bytes of data. -64 bytes from 12.1.1.130: icmp_seq=1 ttl=63 time=40.0 ms -64 bytes from 12.1.1.130: icmp_seq=2 ttl=63 time=39.5 ms -64 bytes from 12.1.1.130: icmp_seq=3 ttl=63 time=11.2 ms -64 bytes from 12.1.1.130: icmp_seq=4 ttl=63 time=11.2 ms +docker-compose-host $: docker exec rfsim5g-oai-nr-ue1 ping -I oaitun_ue1 -c 4 192.168.70.145 +PING 192.168.70.145 (192.168.70.145) from 12.1.1.130 oaitun_ue1: 56(84) bytes of data. +64 bytes from 192.168.70.145: icmp_seq=1 ttl=63 time=9.74 ms +64 bytes from 192.168.70.145: icmp_seq=2 ttl=63 time=9.17 ms +64 bytes from 192.168.70.145: icmp_seq=3 ttl=63 time=8.07 ms +64 bytes from 192.168.70.145: icmp_seq=4 ttl=63 time=5.94 ms ---- 12.1.1.130 ping statistics --- -4 packets transmitted, 4 received, 0% packet loss, time 3003ms -rtt min/avg/max/mdev = 11.206/25.511/40.071/14.292 ms +--- 192.168.70.145 ping statistics --- +4 packets transmitted, 4 received, 0% packet loss, time 3004ms +rtt min/avg/max/mdev = 5.936/8.226/9.739/1.452 ms ``` ## 9. Analyzing Scenario Results