diff --git a/README.md b/README.md index e011d778600535af11e68f1e17cfdc3074fcb634..e08b64198bb5553990bc02b64f8f6976ed68a18a 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ Any non-empty responses are JSON formatted messages. } ``` -* /jobs/interfaces/*`hostname`* +* /data/interfaces/*`hostname`* The response will be a list of information about the interfaces present on the requested host @@ -181,7 +181,7 @@ Any non-empty responses are JSON formatted messages. } ``` -* /jobs/snmp/*`hostname`* +* /data/snmp/*`hostname`* The response will be a list of information about the interfaces discovered through snmp @@ -204,7 +204,7 @@ Any non-empty responses are JSON formatted messages. } ``` -* /jobs/bgp/*`hostname`* +* /data/bgp/*`hostname`* The response will be a list of information about the bgp peerings configured for the requested host diff --git a/changelog b/changelog index 59e0f1d7327b31e14f73ee360422b541b06db6a4..b7777a7190fa3f1b2b9f89c01a1109fa24aced4f 100644 --- a/changelog +++ b/changelog @@ -6,4 +6,5 @@ added snmp index to interface data to support sensu, prometheus increased unit test coverage to 78% 0.6: added a static demo of juniper stuff - added some route docs to README \ No newline at end of file + added some route docs to README +0.7: added static/* to release \ No newline at end of file diff --git a/inventory_provider/static/interfaces.html b/inventory_provider/static/interfaces.html new file mode 100644 index 0000000000000000000000000000000000000000..898841231a75e0dc874307377bef7bae27c4a6b6 --- /dev/null +++ b/inventory_provider/static/interfaces.html @@ -0,0 +1,29 @@ +<!doctype html> +<html ng-app="inventoryApp"> + <head> + <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.5/angular.min.js"></script> + <script src="interfaces.js"></script> + <link rel="stylesheet" href="style.css"> + </head> + <body> + + <div ng-controller="interfaces"> + <h2>Interfaces</h2> + <div> + <select + ng-options="r for r in routers" + ng-change="update_interfaces()" + ng-model="router"></select> + <select + ng-options="i for i in interfaces" + ng-change="update_status()" + ng-model="interface"> + </select> + </div> + + <div> + STATUS: {{status}} + </div> + </div> + </body> +</html> \ No newline at end of file diff --git a/inventory_provider/static/interfaces.js b/inventory_provider/static/interfaces.js new file mode 100644 index 0000000000000000000000000000000000000000..499350b2567bc0295ad6576d283359bdff6c1912 --- /dev/null +++ b/inventory_provider/static/interfaces.js @@ -0,0 +1,51 @@ +var myApp = angular.module('inventoryApp', []); + +myApp.controller('interfaces', function($scope, $http) { + + $scope.routers = []; + $scope.router = ''; + + $scope.interfaces = []; + $scope.interface = ''; + + $scope.status = 'not yet loaded'; + + $http({ + method: 'GET', + url: window.location.origin + "/data/routers" + }).then( + function(rsp) {$scope.routers = rsp.data;}, + function(rsp) {$scope.routers = ['error'];} + ); + + $scope.update_interfaces = function() { + + $http({ + method: 'GET', + url: window.location.origin + "/data/interfaces/" + $scope.router + }).then( + function(rsp) { + $scope.interfaces = rsp.data.map(function(x){ + return x.name + }); + }, + function(rsp) {$scope.interfaces = ['error'];} + ); + } + + $scope.update_status = function() { + + $http({ + method: 'GET', + url: window.location.origin + + "/alarmsdb/interface-status?equipment=" + + $scope.router + + "&interface=" + + $scope.interface + }).then( + function(rsp) {$scope.status = rsp.data.status;}, + function(rsp) {$scope.interfaces = 'query error';} + ); + } + +}); \ No newline at end of file diff --git a/inventory_provider/static/juniper.html b/inventory_provider/static/juniper.html index 5ed7fab8ff687e8d874bd8c9746ad312b848d967..5ccb25324d28e99a0aea763fe3536aa65201fcf4 100644 --- a/inventory_provider/static/juniper.html +++ b/inventory_provider/static/juniper.html @@ -2,21 +2,12 @@ <html ng-app="inventoryApp"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.5/angular.min.js"></script> - <script src="inventoryProvider.js"></script> + <script src="juniper.js"></script> <link rel="stylesheet" href="style.css"> </head> <body> - <!-- - <h2>Routers</h2> - <div ng-controller="inventoryProvider"> - <ul name="routers" class="unstyled"> - <li ng-repeat="r in routers">{{r}}</li> - </ul> - </div> - --> - - <div ng-controller="inventoryProvider"> + <div ng-controller="juniper"> <h2>Interfaces</h2> <div> <select @@ -27,15 +18,33 @@ <div class="column"> <p><b>interfaces</b></p> - {{interfaces}} + <ul> + <li ng-repeat="i in interfaces">{{i.name}} + <ul><li>{{i.description}}</li></ul> + </li> + </ul> + <div class="raw">{{interfaces}}</div> </div> <div class="column"> <p><b>bgp</b></p> - {{bgp}} + <ul> + <li ng-repeat="p in bgp">{{p.description}} + <ul> + <li>local as: {{p.as.local}}</li> + <li>peer as: {{p.as.peer}}</li> + </ul> + </li> + </ul> + <div class="raw">{{bgp}}</div> </div> <div class="column"> <p><b>snmp</b></p> - {{snmp}} + <ul> + <li ng-repeat="i in snmp">{{i.name}} + <ul><li>index: {{i.index}}</li></ul> + </li> + </ul> + <div class="raw">{{snmp}}</div> </div> </div> </body> diff --git a/inventory_provider/static/inventoryProvider.js b/inventory_provider/static/juniper.js similarity index 95% rename from inventory_provider/static/inventoryProvider.js rename to inventory_provider/static/juniper.js index 283b3445058691855a9bac87c35954c31bd9bc21..035a0b442dc07c63ebc427cc4523585b21bbd085 100644 --- a/inventory_provider/static/inventoryProvider.js +++ b/inventory_provider/static/juniper.js @@ -1,6 +1,6 @@ var myApp = angular.module('inventoryApp', []); -myApp.controller('inventoryProvider', function($scope, $http) { +myApp.controller('juniper', function($scope, $http) { $scope.routers = []; $scope.router = ''; diff --git a/inventory_provider/static/style.css b/inventory_provider/static/style.css index e37a1f87faa0c36404f97a9401171d926c179f29..a72ff44af879d3d178cce21668484bca5bae43fa 100644 --- a/inventory_provider/static/style.css +++ b/inventory_provider/static/style.css @@ -8,4 +8,10 @@ content: ""; display: table; clear: both; +} + +.raw { + font-style: italic; + font-size: 10px; + font-family: Courier } \ No newline at end of file diff --git a/setup.py b/setup.py index a1e80f5badf4e9fb9fb3744c59e5ae642f2986bf..b566817b8d8fbd4e67f22aa4ab9cc282d3963d2a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='inventory-provider', - version="0.6", + version="0.7", author='GEANT', author_email='swd@geant.org', description='Dashboard inventory provider',