Mbus
Concepts
Common Management Application Programming Interface (CMAPI)
Open platform
to any daemon below it
to any client above it
Uses adaptation layers to allow any application or daemon
Architecture in three levels
> Client level: contains the applications and clients that need to interact with the MBus. The clients map the parameters of the applications and interfaces to the data model objects in the MBus.
> MBus Level: contains the data model, as well as Import/Export , the Load/Save and the Authentication/Authorization modules
> Daemon level: contains the daemons that need to be configured, as well as their plugins. The plugins map the daemon parameters to the MBus objects.
Client Level
Registers with MBus
Initiates get/set parameter actions
Initiates add/delete object actions
Un)Subscribes to/from events
Receives and processes events
Mbus level
The CMAPI has a limited but complete set of primitives capable of handling these parameters.
Contains no data (stored in the modules)
Daemon level
> Registers with MBus:
Parent objecttype (place in datamodel
Unique objecttype name
Flags: single instance, add/delete, static/
List of parameters
> Name, parameter type, basic value
> Flags: key parameters, writable, mandatory,
> Converts all MBus calls in daemon calls
mbus hierarchy
Typemodel
Datamodel (example)
datamodel.txt
Values of interests for the Bebox
mbusData_forGUI_20090703_bxm.xls
Commands
> getvalues: retrieve the values of one or more parameters of a specific object.
> setvalues: write a value to one or more parameters of an object. Rollback for this action is supported at client command level.
> getcount: number of parameter/value pairs that getvalues would return with the same arguments
> addobject: add an object to the data model.
> deleteobject: delete an object from the data model.
> subscribe: subscribe a client to the MBus event.
> unsubscribe: unsubscribe a client from the MBus event.
Web SDK
AppWeb
run.sh
embedded webserver
CGI via the lua programming language
Folders
include/
webpages/
webpages/img
server-side scripting example
<%= getTitle() %> <% for i, item in ipairs(items) do %>
<% end %><%= i %>. <%= item %> cgilua.QUERY
request to http://dsldevice.lan/foo.lp?xyz=bar&abc=test
print(cgilua.QUERY["xyz"])
bar
print(cgilua.QUERY["abc"])
test
cgilua.POST
print(cgilua.POST["description"])
will print the default value or the user's input
uploaded file are stored in the POST table
filename
filesize
contenttype
LuaCGI methods
cgilua.servervariable"REQUEST_METHOD" == "POST"
cgilua.errorlog(msg, level)
cgilua.switchuser()
cgilua.logout()
cgilua.auth(t)
cgilua.preauth()
Lua
Change made to lua
support for tainted strings
all calculations happen as integers.
all scripts run in a strict mode
global variables only in the main chunk or through the C API
doc
http://www.lua.org/manual/5.1/
http://lua-users.org/wiki/LuaDirectory
removed :
os
math
require()
string.dump()
not removed :
io.open() io.type() f:close() f:read()
os.remove() os.rename()
Commandline ITF
telnet
192.168.1.254 (usually)
Administrator
:mbus listtypes dmtree=atomic path=RSS expand=enabled
:mbus listtypes dmtree=atomic path=DeviceConfig expand=enabled
:mbus debug loadobjects dmtree=atomic path=Language
:mbus listtypes dmtree=atomic path=ETH.Phys expand=enabled
:mbus listenums dmtree atomic name=PhysTechnology expand=enabled
Lua Interface
mbus.modify
-- any code that modify the data stored on a mbus plugin -- must be placed in a mbus.modify anonymous fonction local reply, error = mbus.modify( function() local result, error,reply result, error = mbus.set{...} reply, error = mbus.setParameters(...) result, error = mbus.addObjects { ... } results, errors = mbus.deleteObjects { ... } end)
save configuration
local reply, error = mbus.modify( function() local reply, error = mbus.setParameters{ path = "DeviceConfig", param = {ConfigSaveDelay="20", ConfigSave="1"} } end)
mbus.get
result, error = mbus.get { cwmp_url = "CWMP.Server.URL" }
print(result.cwmp_url and result.cwmp_url or error.cwmp_url)
mbus.getParameters
mbus.getParameters { { path = "DSL", param = "Status_Value" } }
results = { DSL = { { path = "DSL", param = { Status_Value = "NoLink" } } } }
errors = nil
mbust.setParameters
error = mbus.setParameters{ path = "ToD", param = { Enable = "0" } }
mbus.set
result, error = mbus.set { ["DSD.Status"] = "Disabled", ["ToD.Enable"] = "0" }
result = { ENV = { { path = "ENV.97", param = } } }
error = nil
mbus.addObjects
mbus.addObjects { path = "ENV", param = { Name = "test_env", Value = "test" } }
result = { ENV = { { path = "ENV.97", param = { Name = "test_env", Value = "test" } } } }
error = nil
mbus.deleteObjects
results, errors = mbus.deleteObjects { path = "ENV", filter = "(== Name test_env)" }
result = { ENV = { { path = "ENV.97", param = } } }
error = nil
Mbus
Added: 2009-08-18 11:04:03
From: (Joined 2009-08-12 19:34:00)
102 views |0 downloads
Mbus