diff --git a/.gitignore b/.gitignore index c1d1065..d7e52c2 100644 --- a/.gitignore +++ b/.gitignore @@ -103,11 +103,5 @@ pip-selfcheck.json *.retry *.swp -.retry -group_vars/vmware -*.ova -*.iso -*.vmdk -*.mf -*.ovf -.vscode \ No newline at end of file +.vscode +ui/config.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 114c20f..22ffe58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3 +FROM python:3-slim WORKDIR /srv diff --git a/main.py b/main.py index 65cf4c5..4d64b1b 100644 --- a/main.py +++ b/main.py @@ -18,10 +18,11 @@ # -import os import cherrypy -import hashlib import datetime +import hashlib +import logging +import os import yaml import re @@ -496,18 +497,6 @@ def parseFlow(self, flow=None): return data - def save_settings(self, dev_user=None, dev_pw=None, routers=None, age_out_interval=None): - - self.dev_user = dev_user - self.dev_pw = dev_pw - self.age_out_interval = age_out_interval - # self.routers = routers - - # with open('ui/config.yml', 'w') as fp: - # config = {'dev_user': self.dev_user, 'dev_pw': self.dev_pw, 'routers': self.routers, - # 'age_out_interval': self.age_out_interval} - # yaml.safe_dump(config, fp, default_flow_style=False) - def load_settings(self): with open('ui/config.yml', 'r') as fp: @@ -562,13 +551,6 @@ def POST(self, action=None): resp = self.my_dev.delFlowRoute(flowRouteData=input_json) return resp - elif action == 'save': - - input_json = cherrypy.request.json - self.my_dev.save_settings(dev_user=input_json['user'], dev_pw=input_json['password'], - age_out_interval=input_json['age_out_interval']) - return True, 'Successfully saved configuration settings' - else: return False, 'Action not defined' diff --git a/ui/config.yml b/ui/config.yml deleted file mode 100644 index 0a6b0e5..0000000 --- a/ui/config.yml +++ /dev/null @@ -1,12 +0,0 @@ -age_out_interval: 00:03:00 -dev_pw: juniper123 -dev_user: root -communities: - - bgp_flow_arbor:1000:1666 -routers: - - RR: - type: rr - ip: 10.11.111.120 - - PE: - type: asbr - ip: 10.11.111.121 \ No newline at end of file diff --git a/ui/index.html b/ui/index.html index 83eb822..cdffe57 100644 --- a/ui/index.html +++ b/ui/index.html @@ -46,9 +46,7 @@

Monitoring BGP Flow
  • Active Flow Filters
  • -
  • Settings -
  • - +

    @@ -150,43 +148,6 @@

    Monitoring BGP Flow

    -
    -
    -
    -

    Settings

    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -

    - -

    -
    -
    -
    diff --git a/ui/ui.js b/ui/ui.js index bb16881..1b9f68a 100644 --- a/ui/ui.js +++ b/ui/ui.js @@ -32,7 +32,6 @@ $(document).ready(function () { flowRouteModModalBtnEventHandler(); flowRouteModBtnEventHandler(); flowRouteDelBtnEventHandler(); - saveSettingsBtnEventHandler(); var t_flow_config = $('#t_flow_config').DataTable({ 'ajax' : { @@ -620,38 +619,3 @@ function getActiveFlowFilter(pollInterval){ } setTimeout(poll, pollInterval); } - -function saveSettingsBtnEventHandler(){ - - $("#saveDevSettingsBtn").on( "click", function() { - - var data = new Object(); - - data.user = $('#inputDevUser').val(); - data.password = $('#inputDevPassword').val(); - data.ip = $('#inputDevIP').val(); - data.age_out_interval = $('#inputAgeOutInterval').val(); - ageOutInterval = $('#inputAgeOutInterval').val(); - pollInterval = $('#inputPollInterval').val(); - - saveSettings(data); - }); -} - -function saveSettings(settings){ - - $.ajax({ - url: '/api?action=save', - type: 'POST', - data: JSON.stringify(settings), - cache: false, - processData: true, - dataType: 'json', - contentType: 'application/json', - success: function (response) { - }, - error : function (data, errorText) { - $("#errormsg").html(errorText).show(); - } - }); -}