This repository was archived by the owner on Oct 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to python3 restconf tapi grpc
- Loading branch information
Showing
50 changed files
with
1,558 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__pycache__/ | ||
|
||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,34 @@ $ python3 clientTopology.py | |
|
||
== RESTCONF | ||
|
||
=== YANG2SWAGGER | ||
|
||
$ cd /root/OFC_SC472/restconf | ||
$ wget https://github.com/bartoszm/yang2swagger/releases/download/1.1.11/swagger-generator-cli-1.1.11-executable.jar | ||
$ java -jar swagger-generator-cli-1.1.11-executable.jar -yang-dir ../yang/ -output topology.yaml topology | ||
$ java -jar swagger-generator-cli-1.1.11-executable.jar -yang-dir ../yang/ -output connection.yaml connection | ||
|
||
=== SERVER | ||
$ cd /root/OFC_SC472/restconf | ||
$ wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.11/swagger-codegen-cli-3.0.11.jar -O swagger-codegen-cli.jar | ||
Create the server: | ||
$ java -jar swagger-codegen-cli.jar generate -i connection.yaml -l python-flask -o server/ | ||
Run the server: | ||
$ cd /root/OFC_SC472/restconf/server | ||
$ pip3 install -r requirements.txt | ||
(Open /root/OFC_SC472/restconfserver/swagger_server/swagger/swagger.yaml and modify all: "name: connection_id" for "name: connection-id") | ||
RUN AUTOGENERATED SERVER | ||
$ python3 -m swagger_server | ||
|
||
RUN CONNECTION SERVER | ||
$ cd /root/OFC_SC472/restconf/connectionserver | ||
$ python3 -m swagger_server | ||
|
||
RUN CURL AS CLIENT (In another window) | ||
$ cd /root/OFC_SC472/restconf/ | ||
$ curl -X POST -H "Content-Type: application/yang-data+json" http://127.0.0.1:8080/data/connection/ [email protected] | ||
$ curl -X GET -H "Content-Type: application/yang-data+json" http://127.0.0.1:8080/data/connection=0/ | ||
$ curl -X DELETE -H "Content-Type: application/yang-data+json" http://127.0.0.1:8080/data/connection=0/ | ||
|
||
|
||
== RUN ONOS | ||
|
@@ -53,17 +81,73 @@ $ cd /root/OFC_SC472/onos_api/ | |
$ python3 onos_topology.py | ||
|
||
== TAPI | ||
RUN TAPI SERVER: | ||
$ cd /root/OFC_SC472/tapi/server | ||
$ python3 tapi_server.py | ||
|
||
RUN TAPI CLIENT (In a new window): | ||
$ cd /root/OFC_SC472/tapi/client | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/service-interface-point/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/service-interface-point/sip-pe1-uni1/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/topo-nwk/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/topo-nwk/node/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/topo-nwk/node/node-mul-pe-1/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/topo-pe1/node/node-eth-pe-1/owned-node-edge-point/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/topo-pe1/node/node-eth-pe-1/owned-node-edge-point/nep-pe1-eth-uni1/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/topo-nwk/link/link-pe1-odu4-nni1-pi4-odu4-nni2/ | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/topology/topo-pe1/link/link-pe1-eth-pool-pe1-odu2-pool/ | ||
|
||
RUN TAPI_APP | ||
$ cd /root/OFC_SC472/tapi/tapi_app | ||
$ python3 tapi_app.py | ||
|
||
RUN TAPI CLIENT | ||
$ cd /root/OFC_SC472/tapi/client | ||
$ curl -X POST -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/connectivity-service/cs1/ -d @cs1.json | ||
$ curl -X GET -H "Content-Type: application/json" http://127.0.0.1:8080/restconf/config/context/connection/cs1/ | ||
|
||
|
||
== GRPC | ||
$ cd /root/OFC_SC472/grpc | ||
|
||
COMPILE connection.proto: | ||
$ python -m grpc_tools.protoc -I=. --python_out=connection/ connection.proto | ||
|
||
== OPENCONFIG | ||
RUN CREATE AND LIST CONNECTION | ||
$ cd /root/OFC_SC472/grpc/connection | ||
$ python3 create.py connection.txt | ||
$ python3 list.py connection.txt | ||
|
||
COMPILE connectionService.proto | ||
$ python -m grpc_tools.protoc -I=. --python_out=connectionService/ --grpc_python_out=connectionService/ connectionService.proto | ||
|
||
RUN SERVER | ||
$ cd /root/OFC_SC472/grpc/connectionService | ||
$ python3 connectionService_server.py | ||
|
||
RUN CLIENT (in another window) | ||
$ cd /root/OFC_SC472/grpc/connectionService | ||
$ python3 connectionService_client.py | ||
|
||
COMPILE connectionServiceWithNotif.proto | ||
$ cd /root/OFC_SC472/grpc/ | ||
$ python -m grpc_tools.protoc -I=. --python_out=connectionServiceWithNotif/ --grpc_python_out=connectionServiceWithNotif/ connectionServiceWithNotif.proto | ||
|
||
RUN SERVER | ||
$ cd /root/OFC_SC472/grpc/connectionServiceWithNotif | ||
$ python3 connectionServiceWithNotif_server.py | ||
|
||
RUN CLIENT (in another window) | ||
$ cd /root/OFC_SC472/grpc/connectionServiceWithNotif | ||
$ python3 connectionServiceWithNotif_client.py | ||
|
||
|
||
== OPENCONFIG | ||
|
||
== APPENDICES | ||
|
||
=== CONFD | ||
== APPENDIX: CONFD | ||
$ cd /root/OFC_SC472/netconf | ||
$ unzip confd-basic-6.4.linux.x86_64.zip | ||
$ cd confd-basic-6.4.linux.x86_64/ | ||
|
@@ -93,7 +177,7 @@ $ ./confd_cli | |
> exit | ||
> exit | ||
|
||
== NETCONF EDIT-CONFIG | ||
== APPENDIX: NETCONF EDIT-CONFIG | ||
|
||
Run server: | ||
$ cd /root/OFC_SC472/netconf/connection | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,8 @@ | |
|
||
% | ||
conn2node2node1"portB*portA0 | ||
|
||
conn3ab"1*20d | ||
con4fb"2*30o |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#! /usr/bin/env python | ||
#! /usr/bin/env python3 | ||
import connection_pb2 | ||
import sys | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
.travis.yaml | ||
.swagger-codegen-ignore | ||
README.md | ||
tox.ini | ||
git_push.sh | ||
test-requirements.txt | ||
setup.py | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
venv/ | ||
.python-version | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
#Ipython Notebook | ||
.ipynb_checkpoints |
Oops, something went wrong.