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

Commit

Permalink
Utility billing support improved, portable images deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziofiorucci committed Jan 27, 2022
1 parent 8816a37 commit 0981315
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 15 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ F5 Telemetry Tracker requires:

f5tt/f5tt.sh is a sample script to run F5 Telemetry Tracker from bash

## As a portable application

- [All portable images](/portable)
- [AppImage for Linux](/portable/Linux)
- [AppImage for Windows 10](/portable/Windows)

## Additional modes of operation

See the [contrib section](/contrib/)
Expand Down
20 changes: 18 additions & 2 deletions contrib/bigiq-collect/f5ttfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
# https://bigiq.f5.ff.lan/mgmt/cm/system/machineid-resolver/aabcaca7-6986-4d0b-b9fe-b72e3473144e
#

def getFileContent(filename):
def getFileContent(filename,retCode=200):
json=''
retCode=200

try:
with open(jsonDir+"/"+filename,"r") as f:
Expand Down Expand Up @@ -62,6 +61,23 @@ def getDeviceInventoryResults(inventoryId):
def getMachineIdResolver(machineId):
return getFileContent("machineid-resolver-"+machineId+".json")

@app.route('/mgmt/cm/device/licensing/pool/utility/licenses', methods=['GET'])
def getBillingLicenses():
return getFileContent("utilitybilling-licenses.json")

@app.route('/mgmt/cm/device/tasks/licensing/utility-billing-reports', methods=['POST'])
def postsCreateBillingReport():
return getFileContent("utilitybilling-createreport-"+request.json['regKey']+".json",retCode=202)

@app.route('/mgmt/cm/device/tasks/licensing/utility-billing-reports/<string:reportId>', methods=['GET'])
def getCheckBillingReport(reportId):
return getFileContent("utilitybilling-reportstatus-"+reportId+".json")

@app.route('/mgmt/cm/device/licensing/license-reports-download/<string:reportFile>', methods=['GET'])
def getDownloadBillingReport(reportFile):
return getFileContent("utilitybilling-billingreport-"+reportFile)


@app.route('/mgmt/ap/query/v1/tenants/default/products/device/metric-query', methods=['POST'])
def getDeviceMetric():
content = request.get_json(silent=True)
Expand Down
8 changes: 4 additions & 4 deletions contrib/bigiq-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ F5 Telemetry Tracker - https://github.com/fabriziofiorucci/F5-Telemetry-Tracker

## Usage - manual mode

- Start F5 Telemetry Tracker on BIG-IQ CM:
- Start F5 Telemetry Tracker on BIG-IQ CM. Enter BIG-IQ admin username and the password

```
[root@bigiq:Active:Standalone] config # /tmp/f5tt-bigiq-docker.sh -s
Expand All @@ -77,13 +77,13 @@ Uncompressed output:

```
$ curl http://192.168.1.71:5000/instances
{"instances":[{"bigip":2,"hwTotals":[{"F5-VE":2}],"swTotals":[{"H-VE-AFM":1,"H-VE-AWF":1,"H-VE-LTM":2,"H-VE-APM":1,"H-VE-DNS":1}]}],"details":[{"inventoryTimestamp":1641986071513,"inventoryStatus":"full"[...]
{"instances":[{"bigip":2,"hwTotals":[{"F5-VE":2}],"swTotals":[{"H-VE-AFM":1,"H-VE-AWF":1,"H-VE-LTM":2,"H-VE-APM":1,"H-VE-DNS":1}]}],"details":[{"inventoryTimestamp":1641986071513,"inventoryStatus":"full"[...]}
```

Compressed output:

```
curl -s -H "Accept-Encoding: gzip" http://192.168.1.71:5000/instances --output output-json.gz
$ curl -s -H "Accept-Encoding: gzip" http://192.168.1.71:5000/instances --output output-json.gz
```

- Stop F5 Telemetry Tracker:
Expand All @@ -96,7 +96,7 @@ F5 Telemetry Tracker stopped

## Usage - all-in-one mode

- Start F5 Telemetry Tracker on BIG-IQ CM in all-in-one mode:
- Start F5 Telemetry Tracker on BIG-IQ CM in all-in-one mode. Enter BIG-IQ admin username and the password

```
[root@bigiq:Active:Standalone] config # /tmp/f5tt-bigiq-docker.sh -a
Expand Down
3 changes: 3 additions & 0 deletions deprecated/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Deprecated modules

Everything in this section is deprecated, no longer maintained and potentially not working/not complete/broken, kept here for archival purposes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions f5tt/bigiq.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,13 @@ def bigIQCollectUtilityBilling():
res,r = bigIQCheckBillingReport(reportId)

if res == 200:
if r['status'] == "FINISHED":
reportFile = r['reportUri'].split("/")[-1]
res,theReport = bigIQFetchBillingReport(reportFile)
if r['status'] == "FINISHED" or r['status'] == "FAILED":
if 'reportUri' in r:
reportFile = r['reportUri'].split("/")[-1]
res,theReport = bigIQFetchBillingReport(reportFile)
else:
res = 404

retries = 0

if res == 200:
Expand Down

0 comments on commit 0981315

Please sign in to comment.