-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
executable file
·27 lines (24 loc) · 968 Bytes
/
example.php
File metadata and controls
executable file
·27 lines (24 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/php
<?php
require __DIR__ . "/opnsense.php";
//////////////////////////////////////////////////////////////////////////////////////////////
$HOST = "192.168.4.189";
$KEY = 'hQaJfCcxdxxxWFryyyqq9zzzRxSmvo5OYT9nkBgP4z2QmF9pwoxUsKiNn275JjsBuxnn1k5YfC7AOifw';
$SECRET = 't/NJrea8hTO3xxxN4syyymtXzzzLsboKeM6x+8mS32XWhsk3o7RN1GDJHXQMJTuash9poxJkEwgxEGAW';
$DEBUG = 0;
//////////////////////////////////////////////////////////////////////////////////////////////
$osa = new OpnSenseAPI($HOST, $KEY, $SECRET, $DEBUG);
$opnVLANS = $osa->run('interfaces/vlan_settings/searchItem')['rows'];
$IFS = $osa->run('interfaces/overview/interfacesInfo')['rows'];
$res = $osa->run('interfaces/vlan_settings/addItem',[
"vlan" =>
[
'descr' => 'Interface 1',
'if' => 'ixl2',
'pcp' => '0',
'proto' => '',
'vlanif' => 'ixl2_vlan1',
'tag' => 1,
]
]);
$res = $osa->run('interfaces/vlan_settings/reconfigure');