noxrepo / nox

The NOX Controller
Other
139 stars 85 forks source link

passing parametrs #4

Closed vjeko closed 12 years ago

vjeko commented 12 years ago

It wasn't obvious to me, but how would one go about passing parameters to a module?

tootoonchian commented 12 years ago

Sorry it took me so long to answer.

I just updated switch.cc to show how it works.

Similar to NOX Classic, You can pass args to a component with this syntax:

./nox_core -i ptcp: component=arg1,arg2,...

To parse the arguments, you first need to check if any argument has been passed to the component using ctxt->has("args") and if so iterate the list of arguments (ctxt->get_config_list("args")).

To see how this is implemented you can take a look at src/builtin/component.cc lines 118-146, and 316-346.