mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Update powercode integration to use the unified config
This commit is contained in:
parent
475e997482
commit
a0f04840cc
@ -2,20 +2,20 @@ from pythonCheck import checkPythonVersion
|
||||
checkPythonVersion()
|
||||
import requests
|
||||
import warnings
|
||||
from ispConfig import excludeSites, findIPv6usingMikrotik, bandwidthOverheadFactor, exceptionCPEs, powercode_api_key, powercode_api_url
|
||||
from liblqos_python import find_ipv6_using_mikrotik, powercode_api_key, powercode_api_url
|
||||
from integrationCommon import isIpv4Permitted
|
||||
import base64
|
||||
from requests.auth import HTTPBasicAuth
|
||||
if findIPv6usingMikrotik == True:
|
||||
if find_ipv6_using_mikrotik() == True:
|
||||
from mikrotikFindIPv6 import pullMikrotikIPv6
|
||||
from integrationCommon import NetworkGraph, NetworkNode, NodeType
|
||||
from urllib3.exceptions import InsecureRequestWarning
|
||||
|
||||
def getCustomerInfo():
|
||||
headers= {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
url = powercode_api_url + ":444/api/preseem/index.php"
|
||||
url = powercode_api_url() + ":444/api/preseem/index.php"
|
||||
data = {}
|
||||
data['apiKey'] = powercode_api_key
|
||||
data['apiKey'] = powercode_api_key()
|
||||
data['action'] = 'list_customers'
|
||||
|
||||
r = requests.post(url, data=data, headers=headers, verify=False, timeout=10)
|
||||
@ -23,9 +23,9 @@ def getCustomerInfo():
|
||||
|
||||
def getListServices():
|
||||
headers= {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
url = powercode_api_url + ":444/api/preseem/index.php"
|
||||
url = powercode_api_url() + ":444/api/preseem/index.php"
|
||||
data = {}
|
||||
data['apiKey'] = powercode_api_key
|
||||
data['apiKey'] = powercode_api_key()
|
||||
data['action'] = 'list_services'
|
||||
|
||||
r = requests.post(url, data=data, headers=headers, verify=False, timeout=10)
|
||||
|
@ -11,6 +11,7 @@ mod integration_common;
|
||||
mod ip_ranges;
|
||||
mod spylnx_integration;
|
||||
mod uisp_integration;
|
||||
mod powercode_integration;
|
||||
pub use bridge::*;
|
||||
pub use long_term_stats::LongTermStats;
|
||||
pub use tuning::Tunables;
|
@ -58,6 +58,9 @@ pub struct Config {
|
||||
|
||||
/// UISP Integration
|
||||
pub uisp_integration: super::uisp_integration::UispIntegration,
|
||||
|
||||
/// Powercode Integration
|
||||
pub powercode_integration: super::powercode_integration::PowercodeIntegration,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@ -116,6 +119,7 @@ impl Default for Config {
|
||||
integration_common: super::integration_common::IntegrationConfig::default(),
|
||||
spylnx_integration: super::spylnx_integration::SplynxIntegration::default(),
|
||||
uisp_integration: super::uisp_integration::UispIntegration::default(),
|
||||
powercode_integration: super::powercode_integration::PowercodeIntegration::default(),
|
||||
packet_capture_time: 10,
|
||||
queue_check_period_ms: 1000,
|
||||
}
|
||||
|
@ -71,6 +71,9 @@ fn liblqos_python(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||
m.add_wrapped(wrap_pyfunction!(automatic_import_uisp))?;
|
||||
m.add_wrapped(wrap_pyfunction!(automatic_import_splynx))?;
|
||||
m.add_wrapped(wrap_pyfunction!(queue_refresh_interval_mins))?;
|
||||
m.add_wrapped(wrap_pyfunction!(automatic_import_powercode))?;
|
||||
m.add_wrapped(wrap_pyfunction!(powercode_api_key))?;
|
||||
m.add_wrapped(wrap_pyfunction!(powercode_api_url))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -532,4 +535,22 @@ fn automatic_import_splynx() -> PyResult<bool> {
|
||||
fn queue_refresh_interval_mins() -> PyResult<u32> {
|
||||
let config = lqos_config::load_config().unwrap();
|
||||
Ok(config.integration_common.queue_refresh_interval_mins)
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn automatic_import_powercode() -> PyResult<bool> {
|
||||
let config = lqos_config::load_config().unwrap();
|
||||
Ok(config.powercode_integration.enable_powercode)
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn powercode_api_key() -> PyResult<String> {
|
||||
let config = lqos_config::load_config().unwrap();
|
||||
Ok(config.powercode_integration.powercode_api_key)
|
||||
}
|
||||
|
||||
#[pyfunction]
|
||||
fn powercode_api_url() -> PyResult<String> {
|
||||
let config = lqos_config::load_config().unwrap();
|
||||
Ok(config.powercode_integration.powercode_api_url)
|
||||
}
|
Loading…
Reference in New Issue
Block a user