From b98a67c6b7cae7adf64069d9438881cee8575e4d Mon Sep 17 00:00:00 2001 From: Mentor Gashi Date: Mon, 6 May 2019 13:06:43 +0200 Subject: [PATCH] Initial release completition Set SNMP values filled through form, minimal information interface. --- index.php | 111 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 93 insertions(+), 18 deletions(-) diff --git a/index.php b/index.php index 1a121ff..33cbf88 100644 --- a/index.php +++ b/index.php @@ -29,6 +29,10 @@ function cmts() { return get('system.cmts','172.22.0.22'); } function path() { return get('system.path','/home/albismart/tftpboot/'); } function community() { return get('system.community','albismart'); } + // Config Aliases + function modem() { return get('config.modem', @$_GET['modem']); } + function firmware() { return get('config.firmware', @$_GET['firmware']); } + // Saving changes if(isset($_POST) && isset($_GET['page'])) { switch ($_GET['page']) { @@ -48,11 +52,24 @@ function community() { return get('system.community','albismart'); } if(isset($_POST['community'])) { $system['community'] = $_POST['community']; } if(count($system)>0) { save('system', $system); } else { delete('system'); } break; - case 'upgrade-flow': + case 'upgrade-flow': + $system = session('system'); $config = session('config'); if(isset($_POST['firmware'])) { $config['firmware'] = $_POST['firmware']; } if(isset($_POST['modem'])) { $config['modem'] = $_POST['modem']; } if(count($config)>0) { save('config', $config); } else { delete('config'); } + $server = (isset($system['server'])) ? $system['server'] : '172.22.0.13'; + $cmts = (isset($system['cmts'])) ? $system['cmts'] : '172.22.0.22'; + $path = (isset($system['path'])) ? $system['path'] : '/home/albismart/tftpboot/'; + + if(isset($config['modem']) && isset($config['firmware'])) { + $setServer = snmpset($config['modem'], 'public', '1.3.6.1.2.1.69.1.3.1.0', 'a', $server, 150000, 1); + $setFirmware = snmpset($config['modem'], 'public', '1.3.6.1.2.1.69.1.3.2.0', 's', $config['firmware'], 150000, 1); + $setUpgrade = snmpset($config['modem'], 'public', '1.3.6.1.2.1.69.1.3.3.0', 'i', 1, 150000, 1); + + $success = ($setServer && $setFirmware && $setUpgrade) ? 1 : 0; + header('Location: ' . domain() . '?page=upgrade-status&success='.$success.'&modem='.$config['modem'].'&firmware='.$config['firmware']); + } break; case 'upload': $uploadedFirmware = basename($_FILES["new_firmware"]["name"]); @@ -80,7 +97,7 @@ function community() { return get('system.community','albismart'); } -

Browsing:

+

Browsing:

SNMP Object ID's System Settings @@ -97,7 +114,7 @@ function community() { return get('system.community','albismart'); }

Initiate the progress by clicking Start or continue with configurations

- START + START → Configure @@ -221,7 +238,7 @@ function community() { return get('system.community','albismart'); }
-

Session based Upgrade Flow

+

Session based Upgrade Flow

@@ -253,14 +270,16 @@ function community() { return get('system.community','albismart'); }
-

Select a modem and firmware

-
+

Select a modem and firmware

+ +
+
- 0) { foreach($modems as $oid => $modem) { $modemIP = ""; $modemID = ""; if($modem=='0.0.0.0') continue; @@ -296,15 +315,13 @@ function community() { return get('system.community','albismart'); }
- + + + 0) { foreach($images as $image) { + $firmware = str_replace(path(),'', $image); + echo '
@@ -323,10 +340,10 @@ function community() { return get('system.community','albismart'); }
-
+
@@ -339,6 +356,64 @@ function community() { return get('system.community','albismart'); } + + +
+
+
+
+

Session based Upgrade Flow

+
+
+
+
+
+
+ + TFTP Server IP: + +
+
+ + TFTP Path: + +
+
+ + CMTS IP: + +
+
+ + Modem IP: + +
+
+ + Firmware: + +
+
+
+
+
+ +
+
+
+ + + + +