From 6b5bfc19961277ed5528c0cae48f075fc2e8cc66 Mon Sep 17 00:00:00 2001 From: Karl Newell Date: Fri, 15 Mar 2019 17:15:19 -0400 Subject: [PATCH] Add .gitignore Update data/frt.yml Update to only query for active routes. Multiple originators is breaking current logic Update main.py Enable console debugging. Changed port to 8088. Changed loadFlowRouteConfig to only use XML. Was defaulting to JSON on JunOS > 14 but JSON is not working with pyez on Ubuntu --- .gitignore | 115 +++++++++++++++++++++++++++++++++++++++++++++++++-- data/frt.yml | 3 +- main.py | 7 ++-- 3 files changed, 118 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 98af4c5..bb51700 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,112 @@ -*retry -attic -.idea +id_rsa +id_rsa.pub +# 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/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +venv/ +ENV/ +.Python +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +[Ss]hare +pyvenv.cfg +.venv +pip-selfcheck.json + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject +*.retry +*.swp + +.retry +group_vars/vmware +*.ova +*.iso +*.vmdk +*.mf +*.ovf diff --git a/data/frt.yml b/data/frt.yml index b6f7f64..4974407 100644 --- a/data/frt.yml +++ b/data/frt.yml @@ -10,6 +10,7 @@ FlowRoutesTable: rpc: get-route-information args: extensive: True + active-path: True table: 'inetflow.0' args_key: table item: route-table/rt @@ -24,4 +25,4 @@ FlowRoutesView: age: rt-entry/age action: rt-entry/communities/community action_141: rt-entry/communities/extended-community - tsi: tsi \ No newline at end of file + tsi: tsi diff --git a/main.py b/main.py index 879eb2e..0f15ea6 100644 --- a/main.py +++ b/main.py @@ -292,7 +292,8 @@ def loadFlowRouteConfig(self): # Junos 14.1RX does not support json so let's go with XML here - if int(version[0]) <= 14 and int(version[1]) <= 1: +# if int(version[0]) <= 14 and int(version[1]) <= 1: + if True: data = dev.rpc.get_config(options={'format': 'xml'}, filter_xml='routing-options/flow') @@ -517,8 +518,8 @@ def POST(self): webapp.api.frt = Frt(my_dev=my_dev) webapp.api.frct = Frtc(my_dev=my_dev) webapp.api.frft = Frft(my_dev=my_dev) - cherrypy.config.update({'log.screen': False, + cherrypy.config.update({'log.screen': True, 'server.socket_host': '0.0.0.0', - 'server.socket_port': 8080, + 'server.socket_port': 8088, }) cherrypy.quickstart(webapp, '/', conf)