Skip to content

Commit

Permalink
Merge pull request #39 from atlanticwave-sdx/develop
Browse files Browse the repository at this point in the history
Ready for release 1.0.0
  • Loading branch information
YufengXin authored Jun 20, 2022
2 parents 5121d98 + 656e572 commit f548ff9
Show file tree
Hide file tree
Showing 79 changed files with 5,139 additions and 565 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Install Python dependencies, run tests and lint.
#
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]

permissions:
contents: read

jobs:
test:

runs-on:
- ubuntu-latest

strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"

steps:
- name: Check out code
uses: actions/checkout@v3

# See https://github.com/marketplace/actions/setup-python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

# See https://github.com/marketplace/actions/cache
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Set up pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names.
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=10 --statistics
- name: Run tests
run: |
pytest
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ignore some usual virtual environments.
venv*

# Ignore files added by editors and OS.
*.swp
*.swo
*~
*.bak
.*.kate-swp
*.DS_Store

# Ignore files generated by build tools.
*.pyc
*.pyo
*.egg-info/
*.egg
.pc

# Ignore files generated by coverage tools.
/.coverage
/.coverage.*
/.coverage.el
/coverage.xml

# Ignore files generated when running tests.
/tests/data/amlight.png
/tests/data/sdx.png
/tests/data/sdx-out.json
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

- [How to Contribute](#contrib)
- [AW-SDX Data Model](#datamodel)
- [How to test and use](#usage)
- [AW-SDX Accompanying Projectsl](#accompany)

## <a name="contrib"></a>How to Contribute

1. Ensure you're able to run the existing code in your own [development environment](#setup).
2. Create a descriptive [GitHub issue](https://github.com/atlanticwave-sdx/datamodel/issues) that outlines what feature you plan to contribute.
3. Clone the repository, and start from the most recent version of the [develop branch](https://github.com/atlanticwave-sdx/datamodel.git).
3. Clone the repository, and start from the most recent version of the [develop branch](https://github.com/atlanticwave-sdx/datamodel/tree/develop).
4. Name your branch using the Github issue number as a prefix along with a brief name that corresponds to your feature (e.g., `8-how-to-contribute`).
5. Once satisfied with your completed and tested work, submit a [pull request](https://github.com/atlanticwave-sdx/datamodel.git) against the **develop** branch so that your code can be reviewed by the team.
5. Once satisfied with your completed and tested work, submit a [pull request](https://github.com/atlanticwave-sdx/datamodel/pulls) against the **develop** branch so that your code can be reviewed by the team.

Notes:

Expand Down Expand Up @@ -43,4 +44,31 @@ This set of updates mainly come from the domain monitoring system which is suppo
## Topology description schemas
There are defined in the *schema* subfolder. Some attributes of each objects are requied (Can be found in the API definition) while some are optional. Two attributes are worth of mentioning: (1) In the *service* object, there is a *vender* attribute for the domain to list device vendors that are NOT in its domain, (2) in the topology, link, node, and port objects, there is an *private* attibute for the domain to list attributes that need to kept private.:wq

## <a name="usage"></a>Usage

### Running tests

Run tests with:

```
python -m pip install -r test-requirements.txt
python -m unittest
```

If you want to run some specific tests:

```
python -m unittest -v tests.test_topology_handler
python -m unittest -v tests.test_topology_validator
```

## Install
```
pip install -r requirements.txt
```
```
pip install -e .
```


## <a name="accompany"></a>Accompanying AW-SDX Projects
101 changes: 101 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
1. topology.json
{
"type": "object",
"properties": {
"id": { // must be provided by SDX, not by OXPO// source IP of the OXPO?
"type": "string"
},
"links": ["repository://"], // urn:sdx:link:amlight:novi01_2_novi02_2
"name": "AmLight",
"nodes": ["repository://Node_novi01", "repository://Node_novi02", "repository://Node_novi03"],
"time_stamp": "06-31-2021-11:23:59", // is residual bandwidth going to change the timestamp?
"version": "1", // is residual bandwidth going to change the version?
"domain_service": {
"$ref": "repository://Service"
}
},
"title": "Topology"
}

Are "Links" for inter-domain as well?
how to specify the inter-domain connections?

Each attribute must have a qualifier for private or public
how to push for updates (full topology, just the change, or just a notification of a change)

Future:
topology capabilities: INT/JTI, counters


2. port.json
{
"type": "object",
"properties": {
"id": "2", // ID used by the equipment (of_port or ifIndex) maybe URN?
"short_name": "???? What fields are mandatory or optional",
"name": "2", // "Examples: Juniper: xe-1/1/0, Brocade: eth2/5, Dell Hu-1/2"
"node": "repository://Node_novi01",
"type": "100GbpsE",
"encapsulation": "VLAN", // what's the difference between label and encapsulation?
"label": "vlan",
"swapping_capability": {
"type": "string",
"enum": [
"vlan" // ?
]
},
"label_range": [[1, 5], [100, 200], [34, 34]],
// mtu is desired because of INT and VXLAN
"inter-domain": "SAX:Switch1:Port2", // full URN
"inter-domain": "sfsadfsadfdsfgsdfgfdsgfsdgfdsgfsd", // shared string
// description
"status": "?????? // state and status could be multivalue. Boolean not enough [provisioning|decom|maintenance|up|down|optimal|suboptimal]"
},
"title": "Port"
}
3. link.json
{
"type": "object",
"properties": {
"id": "urn:sdx:link:amlight:novi01_2_novi02_2",
"short_name": "",
"name": "novi01_2_novi02_2",
"ports": ["repository://Port_novi01_02", "repository://Port_novi02_02"],
"total_bandwidth": // no an SDX issue. I suggest removing it.
{ //unit bps? minimum and maximum must be conditioned to the interface.type (10GE for instance)
"type": "number",
"minimum": 1,
"maximum": 1000000
},
"bandwidth": { // 10Mbps - 1Tbps
"type": "number",
"minimum": 0,
"maximum": 1000000 // no max, just > 0
},
"latency": { // ns or ms?
"type": "number",
"minimum": 0,
"maximum": 1000000 // no max, just > 0
},
"packet loss": { // %
"type": "number",
"minimum": 0,
"maximum": 100
},
"availability": { // %
"type": "number",
"minimum": 0,
"maximum": 100
},
"residual_bw": { // based on the last X time? what is X? // array with last 30s, last 5min, last hour, last day, last week
"type": "number",
"minimum": 0,
"maximum": 100
}
},
"title": "Link"
}
4. node.json
24 changes: 0 additions & 24 deletions models/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions parsing/exceptions.py

This file was deleted.

36 changes: 0 additions & 36 deletions parsing/topologyhandler.py

This file was deleted.

Loading

0 comments on commit f548ff9

Please sign in to comment.