Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangjie
OpenXG-RAN
Commits
550b2831
Commit
550b2831
authored
Jul 21, 2021
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ci): adding parser and git template yaml file
Signed-off-by:
Raphael Defosseux
<
raphael.defosseux@eurecom.fr
>
parent
751a92ae
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
17 deletions
+110
-17
ci-scripts/python_v2/README.md
ci-scripts/python_v2/README.md
+6
-0
ci-scripts/python_v2/cls_cn.py
ci-scripts/python_v2/cls_cn.py
+2
-1
ci-scripts/python_v2/cls_ran.py
ci-scripts/python_v2/cls_ran.py
+2
-1
ci-scripts/python_v2/cls_ue.py
ci-scripts/python_v2/cls_ue.py
+2
-1
ci-scripts/python_v2/git_info_template.yaml
ci-scripts/python_v2/git_info_template.yaml
+9
-0
ci-scripts/python_v2/oai-ci-test-main.py
ci-scripts/python_v2/oai-ci-test-main.py
+83
-14
ci-scripts/python_v2/setup.cfg
ci-scripts/python_v2/setup.cfg
+6
-0
No files found.
ci-scripts/python_v2/README.md
View file @
550b2831
...
...
@@ -88,3 +88,9 @@ flake8 oai-ci-test-main.py
```
You shall have no error message.
## Usage ##
```
bash
python3 ./oai-ci-test-main.py
--infra_yaml
testinfra-as-code.yaml
--tstcfg_yaml
test-example.yaml
--git_yaml
git_info_template.yaml
--mode
BuildAndTest
```
\ No newline at end of file
ci-scripts/python_v2/cls_cn.py
View file @
550b2831
...
...
@@ -27,8 +27,9 @@ For more information about the OpenAirInterface (OAI) Software Alliance:
class
CN
:
"""Object class to support any Core Network operations."""
def
__init__
(
self
,
infra
,
config
,
deployment
):
def
__init__
(
self
,
infra
,
config
,
deployment
,
git_info
):
self
.
Deployment
=
deployment
self
.
Infra
=
infra
self
.
GitInfo
=
git_info
for
key
,
val
in
config
.
items
():
setattr
(
self
,
key
,
val
)
ci-scripts/python_v2/cls_ran.py
View file @
550b2831
...
...
@@ -27,8 +27,9 @@ For more information about the OpenAirInterface (OAI) Software Alliance:
class
NodeB
:
"""Object class to support any RAN (eNB/gNB) operations."""
def
__init__
(
self
,
infra
,
config
,
deployment
):
def
__init__
(
self
,
infra
,
config
,
deployment
,
git_info
):
self
.
Deployment
=
deployment
self
.
Infra
=
infra
self
.
GitInfo
=
git_info
for
key
,
val
in
config
.
items
():
setattr
(
self
,
key
,
val
)
ci-scripts/python_v2/cls_ue.py
View file @
550b2831
...
...
@@ -27,8 +27,9 @@ For more information about the OpenAirInterface (OAI) Software Alliance:
class
UE
:
"""Object class to support any UE operations."""
def
__init__
(
self
,
infra
,
config
,
deployment
):
def
__init__
(
self
,
infra
,
config
,
deployment
,
git_info
):
self
.
Deployment
=
deployment
self
.
Infra
=
infra
self
.
GitInfo
=
git_info
for
key
,
val
in
config
.
items
():
setattr
(
self
,
key
,
val
)
ci-scripts/python_v2/git_info_template.yaml
0 → 100644
View file @
550b2831
git
:
url
:
GIT_URL
branch
:
GIT_BRANCH
commit
:
GIT_COMMIT
merge_request
:
status
:
no
id
:
MR_IID
src_branch
:
SRC_BRANCH
src_commit
:
SRC_COMMIT
ci-scripts/python_v2/oai-ci-test-main.py
View file @
550b2831
...
...
@@ -23,6 +23,8 @@ For more information about the OpenAirInterface (OAI) Software Alliance:
"""
import
argparse
import
yaml
import
cls_cn
...
...
@@ -30,6 +32,46 @@ import cls_ran
import
cls_ue
def
_parse_args
()
->
argparse
.
Namespace
:
"""Parse the command line args
Returns:
argparse.Namespace: the created parser
"""
parser
=
argparse
.
ArgumentParser
(
description
=
'OAI CI Test Framework'
)
# Infra YML filename
parser
.
add_argument
(
'--infra_yaml'
,
'-in'
,
action
=
'store'
,
required
=
True
,
help
=
'Setup Infrastructure Yaml File'
,
)
# Test Configuration YML filename
parser
.
add_argument
(
'--tstcfg_yaml'
,
'-tc'
,
action
=
'store'
,
required
=
True
,
help
=
'Test Configuration Yaml File'
,
)
# Git Information YML filename
parser
.
add_argument
(
'--git_yaml'
,
'-g'
,
action
=
'store'
,
required
=
True
,
help
=
'Git Information Yaml File'
,
)
# Mode
parser
.
add_argument
(
'--mode'
,
action
=
'store'
,
required
=
True
,
choices
=
[
'BuildAndTest'
,
'RetrieveLogs'
],
help
=
'OAI CI Test Mode'
,
)
return
parser
.
parse_args
()
def
get_test_infrastructure
(
filename
):
"""
Load the test infrastructure.
...
...
@@ -60,14 +102,30 @@ def get_test_config(filename):
return
test_config
def
get_test_objects
(
key
,
infrastructure
,
test_cfg
):
def
get_git_info
(
filename
):
"""
Load the git information data model.
Args:
filename: yaml description file of git information
Returns:
test_config: git information data model
"""
with
open
(
filename
,
'r'
)
as
git_yml
:
git_info
=
yaml
.
safe_load
(
git_yml
)
return
git_info
def
get_test_objects
(
key
,
infra
,
test_cfg
,
git_info
):
"""
Load the test objects.
Args:
key: relevant keys to select
infra
structure
: infrastructure data model
infra: infrastructure data model
test_cfg: test configuration data model
git_info: git information data model
Returns:
dict_obj: dictionary of objects under test
...
...
@@ -80,25 +138,36 @@ def get_test_objects(key, infrastructure, test_cfg):
# create dict of Objects under test
dict_obj
=
{}
for
elt
in
elements
:
deploy
ment
=
test_cfg
[
'config'
][
key
][
key
][
elt
][
'Deploy'
]
deploy
=
test_cfg
[
'config'
][
key
][
key
][
elt
][
'Deploy'
]
# retrieve the infra part of the element under test only
obj_part
=
infra
structure
[
part
][
elt
]
obj_part
=
infra
[
part
][
elt
]
if
key
==
'RAN'
:
dict_obj
[
elt
]
=
cls_ran
.
NodeB
(
infra
structure
,
obj_part
,
deployment
)
dict_obj
[
elt
]
=
cls_ran
.
NodeB
(
infra
,
obj_part
,
deploy
,
git_info
)
elif
key
==
'CN'
:
dict_obj
[
elt
]
=
cls_cn
.
CN
(
infra
structure
,
obj_part
,
deployment
)
dict_obj
[
elt
]
=
cls_cn
.
CN
(
infra
,
obj_part
,
deploy
,
git_info
)
elif
key
==
'UE'
:
dict_obj
[
elt
]
=
cls_ue
.
UE
(
infra
structure
,
obj_part
,
deployment
)
dict_obj
[
elt
]
=
cls_ue
.
UE
(
infra
,
obj_part
,
deploy
,
git_info
)
else
:
pass
return
dict_obj
if
__name__
==
'__main__'
:
testbench
=
'testinfra-as-code.yaml'
test
=
'test-example.yaml'
infrastructure
=
get_test_infrastructure
(
testbench
)
test_cfg
=
get_test_config
(
test
)
RAN
=
get_test_objects
(
'RAN'
,
infrastructure
,
test_cfg
)
CN
=
get_test_objects
(
'CN'
,
infrastructure
,
test_cfg
)
UEs
=
get_test_objects
(
'UE'
,
infrastructure
,
test_cfg
)
# Parse the arguments to recover the YAML filenames
args
=
_parse_args
()
# Retrieve the infrastructure
infrastructure
=
get_test_infrastructure
(
args
.
infra_yaml
)
# Retrieve the test configuration (ie infra being used and testsuite)
test_cfg
=
get_test_config
(
args
.
tstcfg_yaml
)
# Retrieve the git information
git_info
=
get_git_info
(
args
.
git_yaml
)
# Populate objects
RAN
=
get_test_objects
(
'RAN'
,
infrastructure
,
test_cfg
,
git_info
)
CN
=
get_test_objects
(
'CN'
,
infrastructure
,
test_cfg
,
git_info
)
UEs
=
get_test_objects
(
'UE'
,
infrastructure
,
test_cfg
,
git_info
)
for
key1
in
RAN
.
keys
():
print
(
key1
,
RAN
[
key1
].
Type
)
if
args
.
mode
==
'BuildAndTest'
:
print
(
'Mode is BuildAndTest'
)
if
args
.
mode
==
'RetrieveLogs'
:
print
(
'Mode is RetrieveLogs'
)
ci-scripts/python_v2/setup.cfg
View file @
550b2831
...
...
@@ -7,8 +7,14 @@ ignore =
WPS110, # Found wrong variable name
WPS210, # Found too many local variables
WPS219, # Found too deep access level
WPS226, # Found string constant over-use
WPS306, # Found class without a base class
WPS317, # Found incorrect multi-line parameters
WPS420, # Found wrong keyword
WPS421, # Found wrong function
# Darglint warnings
DAR003, # Incorrect indentation
DAR102, # Excess parameter(s) in Docstring
# pydocstyle warnings
D107, # Missing docstring in __init_
D2, # White space formatting for doc strings
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment