学习材料:http://noxrepo.org/noxwiki/index.php/NOX_Installation#Installation
Q&A:
Many users start by playing around with the pyswitch component as is it a simple example written in python only, and it is a good start to get a feeling of the framework. Look at the code, see how it utilizes the python core API (defined in src/nox/lib/core.py) and maybe start experimenting with it using a single Openflow switch as the controlled entity. For a more challenging step, look at the Routing module, which makes use of the Authenticator, Topology and Discovery components, to see how you can start building bigger, multi-component applications.
However, keep in mind that what you just installed is merely a framework for programming network behaviours. The included Components are there to set a foundation and give examples of how NOX can be used. From know on, what happens with NOX and your network is what you want (and program) it to do.
In order to see an example of setting up flows through a NOX component written in python, you can look at /src/nox/coreapps/examples/pyswitch.py The idea is that you need to construct the openflow packet manually, filling out the flow description and the actions, and then send it to the desired switch. Deleting flows works in the same way. The process is the same in a C++ component, just the API differs a bit.
========================================================================
Using NOX:
NOX must be invoked by the command line within the build/src directory. Generally, the command that starts the controller looks like this:
./nox_core [OPTIONS] [APP[=ARG[,ARG]...]] [APP[=ARG[,ARG]...]]...
Normally, NOX listens on a TCP port (SSL is supported though poorly documented at the moment) waiting for switches to connect. Once switches connect, NOX will dispatch network packets to the running components, and send OpenFlow messages to the switches on behalf of the components.
For instance, the following will initiate NOX, listening for incoming connections from Openflow switches on port 6633 (the Openflow protocol port):
./nox_core -v -i ptcp:6633
At this point, the core of NOX is running. However, while switches can now connect to the controller, no behaviour will be imposed on them by NOX. Recall that NOX is intended to provide the control logic for an entire network. This can mean many things, including: handling traffic engineering; routing; authentication; access control; virtual network creation; monitoring; and diagnostics. However, NOX itself does none of these things. Rather, it provides a programmatic interface to network components which perform the useful functionality. So, what is missing from the above command in order to give life to a NOX network is the Components NOX should run. These are passed as arguments to the above command.
=====================================================================
NOX componets:
This is the list of network applications that actually manage the network:
Net components are located in src/nox/netapps/
NOX Web applications are used for managing NOX through web services.
Web components are located in src/nox/webapps/
The components listed above are only those that come with the current NOX packaging. However it should be clear that NOX core is only the platform for programming network behaviour, and its power lies in its extensibility. The network behaviour itself is defined by the applications that NOX runs. Many extensions to NOX have been developed by various developers and researchers. Below is a non-extensive list with examples of third party NOX applications and projects that utilize NOX:
The following extensions have since been incorporated into NOX.
=====================================================================
NOX events:
NOX contains a number of built-in events which map directly to OpenFlow messages received by controlled switches. These include:
In addition, components themselves may define and throw higher level events which may be handled by any other events. The following events are thrown by existing NOX components.