NOX的使用之学习篇【三】

本文介绍了NOX网络控制系统中的核心组件,包括Topology、Routing及多种事件处理机制。Topology记录网络中所有活动链接的状态;Routing负责维护网络内任意两点间的最短路径,并与Topology组件互动以更新路由信息。此外,还详细解释了Packet_in、Link、Flow_expired等事件的作用。

资料来源:http://noxrepo.org/noxwiki/index.php/Special:AllPages

 

Topology

From Wikidb

Jump to: navigation, search

Overview

The Topology application provides an in-memory record of all links currently up in the network. It does not post any events, but rather exposes methods to retrieve the links sourced at any given datapath in the network.

 

 

=============================================================================

 

Routing

From Wikidb

Jump to: navigation, search

Overview

The routing application keeps track of shortest-path routes between any two authenticated datapaths in the network. Routing interacts with the Topology component in order to maintain routes. On link changes, the set of affected routes is updated.

Routing currently listens for Flow_in_events which are raised by the Authenticator when a Packet_in_event is received from the network, and routes them by setting up exact match flow entries in all switches along the path from the source to destination access points.

Routing operates as follows:

  • It pulls in the authenticator component which tracks MAC addresses and the switch ports they are bound to
  • For each packet in which the destination MAC address has been discovered, a point to point route is calculated and a flow entry is added to each switch along path.
  • If the destination MAC has not been discovered, the packet is flooded

In that sense, the name of the component "Routing" does not refer to standard IP based routing. This has been the source of a lot of confusion and the module should probably be renamed to "forwarding" or something similarly generic. Its operation is simple, "routing" identifies hosts by their MACs and sets up routes per-flow. If routing doesn't know the location of the destination MAC, it floods the packet. The flows themselves are exact match for all OpenFlow fields (and therefore that routing decision should only apply to the packets of that particular flow).

 

============================================================================

 

Packet in event

From Wikidb

Jump to: navigation, search

This event is defined in the file src/include/packet-in.hh

 

=============================================================================

 

Link event

From Wikidb

Jump to: navigation, search

This event is defined in the file src/nox/apps/discovery/link-event.hh

============================================================================

Flow expired event

From Wikidb

Jump to: navigation, search

This event is defined in the file src/include/flow-expired.hh

Flow expired events are thrown for each openflow expiration message received by the controller.

Expiration messages are sent by the switches on flow timeout (either hard or soft). Flow expirations are only generated by switches if they to do so by the controller (flow expirations are not enabled in NOX by default).

 

=========================================================================

 

Datapath leave event

From Wikidb

Jump to: navigation, search

This event is defined in the file src/include/datapath-leave.hh

 

=========================================================================

 

NOX API notes

From Wikidb

Jump to: navigation, search

General

All of the packet processing code is in nox/lib/packet/.

In general you can iterate over the packet headers using .next. So packet.next should be the IP header. packet.next.next the tcp header and so on. Note that if VLANs are in play, they'll come in as an additional header.

Alternatively, if you know what type of packet you have, you can also use the protocol name (rather than next)

my_iphdr = packet.ip


Authenticator

One way to get the location of a MAC is to call authenticator::get_dl_addr_entry()

The returned DLEntry should contain all known locations for that address.


Routing

Other applications can also ask the routing module for a specific route using the “get_route” method.


Topology

pytopology has a method get_outlinks thats takes a source datapathid and destination datapathid, and returns a list of all of the port pairs that are connected. This is defined in pytopology.i

For example:

if datapath 1's ports 5 and 6 are connected to datapath 2's ports 3 and 4 respectively, you would have the following.

from nox.lib.netinet.netinet import create_datapathid_from_host

dp1 = create_datapathid_from_host(1) dp2 = create_datapathid_from_host(2) ports = pytop.get_outlinks(dp1, dp2)

where ports would be a list of PyLinkPorts of length 2, where PyLinkPorts is described in that pytopology.i file. Particularly it would be the equivalent of [ (5, 3), (6, 4) ] , however it's actually a SWIG-ed out list, which needs to be iterated through using begin(), incr(), and end().

版权声明:本文为博主原创文章,未经博主允许不得转载。

转载于:https://www.cnblogs.com/wangicter/archive/2011/07/01/4767469.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值