Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #36 from agccie/2.0
Browse files Browse the repository at this point in the history
2.0
  • Loading branch information
agccie authored Feb 23, 2019
2 parents 498bc4c + b33e123 commit 6e11a72
Show file tree
Hide file tree
Showing 619 changed files with 67,101 additions and 80,668 deletions.
15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@

# ignore private instance configurations
instance/*
app.wsgi
# ignore auto-copied app.json to Service/ or UIAssets/
Service/app.json
UIAssets/app.json
UIAssets.build/
UIAssets/node_modules
UIAssets/.vscode*
# ignore build info
version.txt

# ignore packager files and Media vidoes
aci_app_packager.log
cisco_aci_app_tools-1.2_min.tar.gz
*.aci
*.mp4
.tmpDocker

# Byte-compiled / optimized / DLL files
__pycache__/
Expand All @@ -23,7 +32,6 @@ __pycache__/
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -100,3 +108,6 @@ ENV/
# Rope project settings
.ropeproject

# ignore .idea from IDEs
.idea

File renamed without changes.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

17 changes: 17 additions & 0 deletions Media/Readme/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
The EnhancedEndpointTracker is a Cisco ACI application that maintains a database of endpoint
events on a per-node basis allowing for unique fabric-wide analysis. The application can be
configured to analyze, notify, and automatically remediate various endpoint events. This gives
ACI fabric operators better visibility and control over the endpoints in the fabric.

Features include:

- Easy to use GUI with fast type-ahead search for any mac/ipv4/ipv6 endpoint in the fabric
- Move, offsubnet, rapid, and stale endpoint analysis
- Configurable notification options via syslog/email for various events detected by the app
- Capability to clear an endpoint on one or more nodes via GUI or API
- Distributed architecture allowing app to grow based on the size of the fabric
- Fully documented swagger API to allow for easy integration with other tools.

For more details, refer to the online documentation at:
http://aci-enhancedendpointtracker.readthedocs.io/en/latest/

Binary file added Media/Snapshots/snapshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/Snapshots/snapshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/Snapshots/snapshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
# Enhanced Endpoint Tracker
# EnhancedEndpointTracker

The Enhanced Endpoint Tracker is a Cisco ACI application that maintains a
database of endpoint events on a per-node basis allowing for unique fabric-wide
analysis. The application can be configured to analyze, notify, and
automatically remediate various endpoint events. This gives ACI fabric
operators better visibility and control over the endpoints in the fabric.
The EnhancedEndpointTracker is a Cisco ACI application that maintains a database of endpoint
events on a per-node basis allowing for unique fabric-wide analysis. The application can be
configured to analyze, notify, and automatically remediate various endpoint events. This gives
ACI fabric operators better visibility and control over the endpoints in the fabric.

Features include:

1. Easy to use GUI for viewing endpoint state and events within the fabric
2. Per-node event history for each endpoint in the fabric. This allows
administers to quickly verify that each node in the fabric has learned an
endpoint correctly
3. Analysis and Notifications for the following events:
* Endpoint move
* Off-subnet learns
* Stale endpoint
4. Notifications can be sent via syslog and email
5. Automatically clear off-subnet endpoints
6. Automatically clear stale endpoints
7. Manually clear an endpoint through the GUI on user-selected nodes
- Easy to use GUI with fast type-ahead search for any mac/ipv4/ipv6 endpoint in the fabric
- Move, offsubnet, rapid, and stale endpoint analysis
- Configurable notification options via syslog/email for various events detected by the app
- Capability to clear an endpoint on one or more nodes via GUI or API
- Distributed architecture allowing app to grow based on the size of the fabric
- Fully documented swagger API to allow for easy integration with other tools.

For more details, refer to the online documentation at:
(http://aci-enhancedendpointtracker.readthedocs.io/en/latest/)
This application is written in python and utilizes a distributed MongoDB database to persist data.
It also relies on a custom Flask framework for handling API requests, Redis for messaging between
components, and Angular with CiscoUI for the frontend.

For more details, refer to the online documentation at:
http://aci-enhancedendpointtracker.readthedocs.io/en/latest/ (http://aci-enhancedendpointtracker.readthedocs.io/en/latest/)
14 changes: 14 additions & 0 deletions Service/app.wsgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

import sys, os, logging, logging.handlers
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

from app import create_app
from app.models.utils import setup_logger
setup_logger(logging.getLogger("app"), quiet=True)
INFO = ["app.models.aci.tools"]
for i in INFO: logging.getLogger(i).setLevel(logging.INFO)
app = create_app("config.py")

# flask requires 'application' variable from wsgi module
application = app

152 changes: 152 additions & 0 deletions Service/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
from flask import Blueprint
from flask import Flask
from flask import abort
from flask import jsonify
from flask import make_response

_app = None
_full_app = None
def _base_app(config_filename="config.py"):
# get a base app file importing user config
global _app
if _app is not None:
return _app
_app = Flask(__name__, instance_relative_config=True)
_app.config.from_object("config")
# try to import instance config file
try:
_app.config.from_pyfile(config_filename)
except IOError: pass
# try to import secret file which overrides instance file
try:
_app.config.from_pyfile("/home/app/config.py", silent=True)
except IOError: pass
# validate and/or set keys. These are treated as passphrases which are converted to 16B keys
ekey= "{0:0>32}".format("".join(["%02x" % ord(c) for c in _app.config.get("EKEY", "")]))[-32:]
eiv = "{0:0>32}".format("".join(["%02x" % ord(c) for c in _app.config.get("EIV", "")]))[-32:]
_app.config["EKEY"] = ekey
_app.config["EIV"] = eiv
return _app

def create_app_config(config_filename="config.py"):
# get app config without initiating entire app
return _base_app().config

def create_app(config_filename="config.py"):
# create full app
global _full_app
if _full_app is not None:
return _full_app

# app based on previously init app
app = _base_app()

# add custom converter (filename) so attribute keys can be type 'filename'
app.url_map.converters["filename"] = FilenameConverter

# import model objects (which auto-register with api)
from .models.aci.fabric import Fabric
from .models.app_status import AppStatus
from .models.rest.swagger.docs import Docs
from .models.rest.swagger.docs import swagger_doc
from .models.rest.settings import Settings
from .models.rest.user import User

# ept objects
from .models.aci.ept.ept_endpoint import eptEndpoint
from .models.aci.ept.ept_epg import eptEpg
from .models.aci.ept.ept_history import eptHistory
from .models.aci.ept.ept_move import eptMove
from .models.aci.ept.ept_node import eptNode
from .models.aci.ept.ept_offsubnet import eptOffSubnet
from .models.aci.ept.ept_pc import eptPc
from .models.aci.ept.ept_queue_stats import eptQueueStats
from .models.aci.ept.ept_rapid import eptRapid
from .models.aci.ept.ept_remediate import eptRemediate
from .models.aci.ept.ept_settings import eptSettings
from .models.aci.ept.ept_stale import eptStale
from .models.aci.ept.ept_subnet import eptSubnet
from .models.aci.ept.ept_tunnel import eptTunnel
from .models.aci.ept.ept_vnid import eptVnid
from .models.aci.ept.ept_vpc import eptVpc

# aci managed objects
from .models.aci.mo.datetimeFormat import datetimeFormat
from .models.aci.mo.fvAEPg import fvAEPg
from .models.aci.mo.fvBD import fvBD
from .models.aci.mo.fvCtx import fvCtx
from .models.aci.mo.fvIpAttr import fvIpAttr
from .models.aci.mo.fvRsBd import fvRsBd
from .models.aci.mo.fvSubnet import fvSubnet
from .models.aci.mo.fvSvcBD import fvSvcBD
from .models.aci.mo.l3extExtEncapAllocator import l3extExtEncapAllocator
from .models.aci.mo.l3extInstP import l3extInstP
from .models.aci.mo.l3extOut import l3extOut
from .models.aci.mo.l3extRsEctx import l3extRsEctx
from .models.aci.mo.mgmtInB import mgmtInB
from .models.aci.mo.mgmtRsMgmtBD import mgmtRsMgmtBD
from .models.aci.mo.pcAggrIf import pcAggrIf
from .models.aci.mo.pcRsMbrIfs import pcRsMbrIfs
from .models.aci.mo.tunnelIf import tunnelIf
from .models.aci.mo.vnsEPpInfo import vnsEPpInfo
from .models.aci.mo.vnsLIfCtx import vnsLIfCtx
from .models.aci.mo.vnsRsEPpInfoToBD import vnsRsEPpInfoToBD
from .models.aci.mo.vnsRsLIfCtxToBD import vnsRsLIfCtxToBD
from .models.aci.mo.vpcRsVpcConf import vpcRsVpcConf

# auto-register api objects
from .models.rest import register
from .models.rest import rest_auth
register(rest_auth)

# register blueprints
from .views.base import base
app.register_blueprint(base)
app.register_blueprint(rest_auth, url_prefix="/api")
app.register_blueprint(swagger_doc, url_prefix="/docs")

# register error handlers
register_error_handler(app)

# if cors is enabled, add to entire app
if app.config.get("ENABLE_CORS", False):
from flask_cors import CORS
CORS(app, supports_credentials=True, automatic_options=True)

_full_app = app
return app

def register_error_handler(app):
""" register error handler's for common error codes to app """
def error_handler(error):
code = getattr(error, "code", 500)
# default text for error code
text = {
400: "Invalid Request",
401: "Unauthorized",
403: "Forbidden",
404: "URL not found",
405: "Method not allowed",
413: "Filesize or request is too large",
500: "Internal server error",
503: "Service unavailable",
}.get(code, "An unknown error occurred")

# override text description with provided error description
if error is not None and hasattr(error, "description") and \
len(error.description)>0:
text = error.description

# return json for all errors for now...
return make_response(jsonify({"error":text}), code)

for code in (400,401,403,404,405,413,500,503):
app.errorhandler(code)(error_handler)

return None

from werkzeug.routing import BaseConverter
class FilenameConverter(BaseConverter):
""" support filename which can be any character of arbitrary length """
regex = ".*?"

File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6e11a72

Please sign in to comment.