怎么把在camtasia编辑视频 9编辑中的文件转到另一台电脑上继续编辑

OpenFlow控制器Floodlight相关介绍 - 推酷
OpenFlow控制器Floodlight相关介绍
#controller模块
controller模块为多数应用实现了一些普通通途的功能
1.发现网络状态和事件(拓扑结构,设备,流量)
2.能够控制网络交换机(network switches)通信(例如,OpenFlow协议)
3.管理floodlight模块,共享存储,线程,测试等资源
4.提供一个web界面和debug服务器(Jython)
一下是目前实现的controller模块:
FloodlightProvider (Dev)
DeviceManagerImpl (Dev)
LinkDiscoveryManager (Dev)
TopologyService (Dev)
RestApiServer (Dev)
ThreadPool (Dev)
MemoryStorageSource (Dev)
Flow Cache (API only)
acket Streamer
DeviceManagerImpl跟踪设备在网络中的移动并且为新流量定义目的设备
#提供的服务
IDeviceService
#依赖的服务
IStorageSourceService
IRestApiService
ICounterStoreService
IThreadPoolService
IFlowReconcileService
IFloodlightProviderService
net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl.
设备管理器通过请求包学习设备。它从包中提取信息并根据设置的实体分类器分类设备。默认地实体分类器使用mac地址和vlan定义一个设备。
这两个属性可以定义一个唯一的设备。设备管理器会学习其他的属性,例如IP地址。一个重要的地方是设备附件(连接)点,如果见环境交换机上
接收到一个包,一个连接点就会为这个设备创建。一个设备在每个Openflow island上可以有一个或者多个连接点。OpenFlow Island定义为
与相同Floodlight Controller交互的一组OpenFlow的强连接集合。设备自身和连接点、ip都会老化,上一次时间戳用来管理其成长过程。
设备是不可变的。这意味这不能持有设备的引用,设备必须通过 IDeviceService接口查询获取。
本模块默认启用,无需更改配置。
URI Description Arguments
/wm/device/ List of all devices tracked by the controller. This includes MACs, IPs, and attachment points. Passed as GET parameters: mac (colon-separated hex-encoded), ipv4 (dotted decimal),vlan, dpid attachment point DPID (colon-separated hex-encoded) and port the attachment point port.
Sample REST calls with curl
Getting all devices
curl -s http://localhost:8080/wm/device/
Getting a device with the IP of 1.1.1.1
curl -s http://localhost:8080/wm/device/?ipv4=1.1.1.1
FloodlightProvider提供两个主要的功能性模块。它处理交换机连接并将OpenFlow消息转换为事件(events)以使其他模块能够监听。
第二个大的功能是它决策某些特定OpenFlow消息(例如,PacketIn, FlowRemoved, PortStatus,等)转发到监听模块的次序。然后模块
决定是否处理消息并传递到下一个监听者或者停止处理消息。
#提供的服务
IFloodlightProviderService
IStorageSourceService
IPktinProcessingTimeService
IRestApiService
ICounterStoreService
IThreadPoolService
本模块在net.floodlightcontroller.core.FloodlightProvider中实现
FloodlightProvider使用Netty处理线程和交换机连接。每个OpenFlow消息会被一个Netty线程处理,并在所有模块中执行该消息相关的逻辑。
其他模块也能注册特定的事件,例如交换机连接、断开连接和端口状态通知等。FloodlightProvider会把这些电报协议的通知转换为其他模块
能够处理的基于Java的消息。要注册OpenFlow消息的模块必须实现IOFMessageListener接口。
本模块默认启用,加载本模块无需更改配置
openFlowPortint6633支持OpenFlow设备连接的Tcp监听端口
workerthreadsint2*cpuNumnetty可创建的线程数,默认为0,表示cpu个数的2倍
controlleridStringlocalhostcontroller的ID
roleStringmaster可以使master、slave、equal。Slave controller不会接收来自交换机的连接,它在一边晾着。
URI Description Arguments&
/wm/core/switch/all/&statType&/json&
Retrieve aggregate stats across all switches.statType: port, queue, flow, aggregate, desc, table, features, host&
/wm/core/switch/&switchId&/&statType&/json&
Retrieve per switch stats.switchId: Valid Switch DPID (XX:XX:XX:XX:XX:XX:XX:XX)&
statType: port, queue, flow, aggregate, desc, table, features, host&
/wm/core/controller/switches/json List of all switch DPIDs connected to the controller. none&
/wm/core/role/json Gets the current controller role. None.&
/wm/core/counter/&counterTitle&/json List of global traffic counters in the controller (across all switches).counterTitle: &all& or something of the form DPID_Port#OFEventL3/4_Type. &See CounterStore.java for details.&
/wm/core/counter/&switchId&/&counterName&/json
List of traffic counters per switch.switchId: Valid Switch DPID&
CounterTitle: see above&
/wm/core/memory/json&
Current controller memory usage. none&
/wm/core/module/{all}/json Returns information about modules and their dependencies.all: &all& or &loaded&.&
link discovery服务负责发现和维护OpenFlow网络(链路)links的状态
#提供的服务
ILinkDiscoveryService
#依赖的服务
IStorageSourceService
IThreadPoolService
IFloodlightProviderService
&net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager
link discovery服务使用LLDPsP和广播(也即BDDPs)来探测链路。LLDP目的MAC是01:80:c2:00:00:0e,BDDP目的MAC是ff:ff:ff:ff:ff:ff
(广播地址)。LLDP和BDDP的以太类型分别是0x88cc和0x8999。为了正确理解这个技术做了以下两个假设。
1。任何交换机(包括OpenFlow交换机)都会消耗一个link-local包(LLDP)
2。Honors layer 2 broadcast (第二层广播)
Links(连接)可以是直接(direct)或者广播(broadcast)。如果一个LLDP被从一个端口发出并且在相同的LLDP在另外的端口被收到则直连就会
被建立。这意味着端口是直接连接的。如果一个BDDP从一个端口发出并再其他端口收到则广播连接就被建立了。这意味这有一个二层交
换机的这两个端口不在controller的控制之下。
默认自启,不需要更改配置即可加载该模块
URI Description Arguments&
/wm/topology/links/json List of all links detected by the controller. None.&
Sample REST calls with curl
Getting all devices
curl -s http://localhost:8080/wm/topology/links/json
PacketStreamer是一个报文流服务,它能选择性的将Openflow交换报文在任意交换机和它的控制器直接进行流向。它包含两个功能接口:
1。基于rest的接口,定义了openflow消息的特征。也即filter,2.基于thrift的接口,过滤包的流向。
REST API Server允许模块通过HTTP暴露rest api。
#提供的服务
IRestApiService
#依赖的服务
net.floodlightcontroller.restserver.RestApiServer.
rest aip Server使用restlet。更过文档在restlet上。其他模块可以依赖rest server,实现restletRoutable来暴露自己的aip。
每个RestletRoutable包含了一个路由,该路由绑定了restlet资源(最普遍的就是serverResource)。为了处理特定url的请求用户可以
附加它们自己的继承了restlet的resource类。在resource注解中比如@GET、@PUT等是选择使用哪种HTTP请求方法。
序列化是通过jackson完成的,jackson库包含在restlet库中。jackson有两种序列化对象的方法。一个是自动使用对象可用的getter方法
序列化这些域,另一中自定义的序列化方式可用在class之上创建和注解。
基础路径不能重叠且必须唯一
restlet只能通过服务接口访问模块数据,如果一个模块需要通过rest server暴露数据,它得开放一个获取那个数据的接口。
无需配置,默认加载
portint8080 rest的http端口
topologyService为controller维护拓扑信息,同时寻找网络中的路由
#提供的服务
ITopologyService
IRoutingService
#依赖的服务
ILinkDiscoveryService
IThreadPoolService
IFloodlightProviderService
IRestApiService
net.floodlightcontroller.topology.TopologyManager
Topology Service在ILinkDiscoveryService中学到的连接信息(link information)的基础上计算拓扑结构。一个重要概念是TopologyService keeps
就是OpenFlow island的概念。island的定义是一组在相同Floodlight实例下的OpenFlow交换机的强连接。islands可以使用非OpenFlow交换机在相同的
2层域中相互连通。举个例子:
[OF switch 1] -- [OF switch 2] -- [traditional L2 switch] -- [OF switch 3]
两个island会被topology Service处理,island1包含交换机1和交换机2,而island2仅包含交换机3
全部的当前拓扑结构被存储在一个叫做topology实例不可变的数据结构中。如果拓扑结构有任何变化,新实例会被创建并且拓扑结构发生变化的通知消息
会被调用。如果其他模块想见他拓扑结构的变化的话,它们可以实现ITopologyListener接口。
尽管可以有冗余的连接进入OpenFlow island,但是不可以有冗余连接从非OpenFlow交换机进入一个OpenFlow island。
不需要额外配置,本模块默认加载。
URI Description Arguments
/wm/topology/switchclusters/json Lists the switch clusters computed by the controller. None.
Sample REST calls with curl
Getting all devices
curl -s http://localhost:8080/wm/topology/switchclusters/json
Flowcache API概念上被定义为在网络中需要处理的一段不同类型的事件,这决定了在floodlight之上的sdn应用何时以及如何处理
这些事件。例如,处理流量的交换机/连接失败事件是多数应用的典型需求。
floodlight定义了一个flow cache API和一组骨架方法作为应用开发者的通用框架,来实现他们应用需求的定制化解决方案。
过些时候我们会把api公布到floodlight网站上,同时api调用的简单解释可以再flowcache源码中找到。
#switch/link down 事件例子
对于flow cache目的的高层解释,我们可以学习switch/link down事件的生命周期来了解相关设计到的模块。
1.目前当LinkDiscoverManager探测到一个下行(down)的连接或者端口,该事件会被TopologyManager中的
“NewInstanceWorker”线程处理。注意,线程最后会调用informListeners,它会通知其他有兴趣处理该事件的模块。
2.所以,第一步你应该创建一个实现了ITopologyListener接口的模块(实现topologyChanged()方法),并调用
TopologyManager.addListener将该模块加入到监听器(listeners)列表中。
3.在你的模块中,你可以通过调用TopologyManager.getLastUpdates()方法获取到所有之前发现的拓扑变更信息。
并且可以对这些事件排序找到有趣的事件。一个失败的交换机导致相邻交换机的连接下线(down),所以你应该查找ILinkDiscoery.UpdateOperation.LINK_REMOVED
事件(每个受影响的交换机一个事件)。找到的元素会告知你涉及到得交换机端口。
4.下一步是查询每个受影响的交换机当前匹配的受影响端口所承载的全部流量。query是个OFSatisticsRequest 消息,
通过sw.sendStatsQuery()发送到交换机sw。
5.一旦查询送出,等待稍后收到响应。为了收到一个OF包的响应,你的模块也应该事先IOFMessageListener接口,并且指定
为OFType.STATS_REPLY消息。当你获得回应后,就可以在响应中看到全部流量。现在你可以决定是否要创建一个删除流量模型(flowmods)来清空流量了。
OK,这个问题似乎已经解决了。但是目前为止我们还没有用到flowcache和与之相关的服务接口。
flow cache的概念是为controller维持一个全部活动流量的记录,当controller的不同模块观察到事件或者不时地查询交换机
时,flow cache会被更新。它将不同模块流量更新和流量查询整合到了一起。
当查询和响应(依据flow cache)在api中出现时,flow cache 数据结构为实现者决策。每个查询也可指定自己的处理器。
流量协调类清空缓存和交换机的流量。你可以有多个模块处理不同的事件,每个都实现了IFlowReconcileListener 接口和
reconcileFlows方法。本方法导致直接动作,或者可以通过OFMatchReconcil 对象把决策传递给另外的模块。模块中也有保持
跟踪查询等待队列的接口。
VirtualNetworkFilter模块是基于网络虚拟化的简单二层(MAC)。它允许你在单个二层域中创建多个逻辑二层网络。本模块能用于
OpenStack部署。
#提供的服务
IVirtualNetworkService
#依赖的服务
IDeviceService
IFloodlightProviderService
IRestApiService
net.floodlightcontroller.virtualnetwork.VirtualNetworkFilter.
Floodlight启动时没有创建虚拟网络,结果是主机之间不能相互通讯。一旦用户创建了虚拟网络主机,就可以把它加入其中。本模块会
在包消息处理链转发前,将自己插入其中。包接收到后它会查找源mac地址和目的mac地址。如果两个mac地址在相同的虚拟网络中,模块会
返回继续命令(Command.CONTINUE),流量就会继续被处理。如果源mac地址和目的mac地址在不同的网络中,模块会返回停止命令(
Command.STOP),包就被丢弃了。
物理网络必须在同一个二层域中。
每个虚拟网络仅能有一个网关(它可以被多个虚拟网络共享)
多播和广播没有被隔离
允许所有的DHCP流量
本模块默认未启用。要加载本模块必须在配置文件中添加配置并重启floodlight。简单的配置文件公布在下面。默认使用的配置文件
在/src/main/resource/quantum.properties
# The default configuration for openstack
floodlight.modules = net.floodlightcontroller.storage.memory.MemoryStorageSource,\
net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\
net.floodlightcontroller.forwarding.Forwarding,\
net.floodlightcontroller.jython.JythonDebugInterface,\
net.floodlightcontroller.counter.CounterStore,\
net.floodlightcontroller.perfmon.PktInProcessingTime,\
net.floodlightcontroller.ui.web.StaticWebRoutable,\
net.floodlightcontroller.virtualnetwork.VirtualNetworkFilter
net.floodlightcontroller.restserver.RestApiServer.port = 8080
net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
net.floodlightcontroller.jython.JythonDebugInterface.port = 6655
如果你正在使用floodlight VM,其配置文件已经存在,简单的执行这些命令就可以启用它。
floodlight@localhost:~$ touch /opt/floodlight/floodlight/feature/quantum
floodlight@localhost:~$ sudo service floodlight stop
floodlight@localhost:~$ sudo service floodlight start
restaip and examples 略。
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致?BrocadeCERBrocadeCESDel;?HPV2linecardsinthe5400z;?IBM8264;?Juniper(MX,EX);?NECIP8800;?NECPF5240;?NECPF5820;?NetGear7328SO;?NetGear7352SO;?Pronto(80)-;可支持的拓扑结构;Floodlig
?Brocade CERBrocade CESDell S4810Dell Z9000Extreme Summit x440, x460, x670HP yl, 5400zl, 6200yl, 6600, and 8200zl (the old-style L3 hardware match platform)
?HP V2 line cards in the 5400zl and 8200zl (the newer L2 hardware match platform)?Huawei openflow-capable router platforms
?Juniper (MX, EX)
?NEC IP8800
?NEC PF5240
?NEC PF5820
?NetGear 7328SO
?NetGear 7352SO
?Pronto (, 3780) - runs the shipping pica8 software
可支持的拓扑结构
Floodlight现在在支持梁中锋不同的包转发应用,这两种应用具有不同的行为,并且向下图的拓
扑结构一样运行:
在转发方面:在网络中的任意两个终端设备之间进行端到端的数据转发
内含OpenFLow网络孤岛(OpenFlow island):到同一OpenFlow网络孤岛中的任意
一设备A发送数据包到设备B,转发模块会计算出A到B之间的最短路径。
内含非OpenFlow网络孤岛(non-OpenFlow island)的OpenFLow网络孤岛:每一个
OpenFlow网络孤岛都可能有一个连接到非OpenFlow孤岛的链接。另外,如图3所示,OpenFlow和非OpenFlow网络孤岛之间不能构成环网
图1:Floodlight接入
OpenFlow网络的例网拓
图2:Floodlight未接入
OpenFlow网络的例网拓
扑,OpenFlow网络孤岛1
有两个到非OpenFlow网
络孤岛的链接
图3:Floodlight未接入
OpenFlow网络的例网拓扑,OpenFlow孤岛和非OpenFlow孤岛形成了一个环网,甚至每一个OpenFlow孤岛
都有唯一一个连接到非OpenFlow孤岛的链接
?当转发路径中超过指定的时间间隔(默认5秒),通过转发超时安装路径。自我学习的交换机:一个简单的二层自我学习交换机:
1 在任何数量的OpenFlow网络孤岛中使用,甚至在非OpenFlow的2层网络孤岛中。
2 不能在环路网路中的网络孤岛中工作,也不能在孤岛形成的环网中工作
3 数据转发效率远高于其他方法
?另外,Floodlight也提供一个Static Flow Entry Pusher应用和一个Circuit Pusher应用,允
许用户主动安装转发路径(proactively install forwarding paths)的行为
1 Static Flow Entry Pusher允许修改交换机流表项,从而创造由用户根据交换机端口明确选择的转发路径
2 CircuitPusher是基于Static Flow Entry Pusher,Device Manager,Routing services的RestAPI,在单个OpenFlow孤岛中建立一个最短路径流
*术语“孤岛”和“集群”是可以互换使用的。一个OpenFlow孤岛/集群就是OpenFlow交换机连接到其中任何设备的集合。类似的,非OpenFlow的孤岛/集群就是任何连接到非OpenFlow交换机的设备。
Floodlight v0.9发行说明
发布日期:2012年10月
Floodlighr v0.9包含了控制器新的RestAPI,新的应用,漏洞修复,新框架测试等
新添加的东西
显示如何进行外部连接,通过BDDP发现多跳链路而不是LLDP
由于处理错误的API并不在发布包中,但是可以通过纯净版的Floodlight下载页面或者在github上的Floodlight-master下载获得。
?/wm/topology/external-links/json
显示在LLDP数据包中发现的直连(DIRECT)和隧道链接(TUNNEL)
?/wm/topology/links/json
给OpenStack/quantum插件的虚拟网络过滤器添加新的API,以显示所有的创建的虚拟网络名,Guid,网关和主机
?/quantum/v1.0/tenants/&tenant&/networks
?Circuit Pusher,一个基于Python的REST应用接口,使用RESTAPI来设置两台IP主机的流。包括新的REST APIsFirewall,一个java应用模块,提供基于控制器的无状态ACL支持
Floodlight不仅仅是一个支持OpenFLow协议的控制器(FloodlightCOntroller),也是一个基于Floodlight控制器的应用集。
当用户在OpenFLow网络上运行各种应用程序的时候,Floodlight控制器实现了对OpenFLow网络的监控和查询功能。图0.0显示了Floodlight不同模块之间的关系,这些应用程序构建成java模块,和Floodlight一起编译。同时这些应用程序都是基于REST API的。
当运行floodlight时,控制器和一组java应用模块(这些会在floodlight属性文件中载入)开始运行。REST API通过REST端口(默认8080)对所有的运行中的模块开放。
Configuration HOWTO
选择加载模块
Floodlight可以配置载入不同的模块以适应不停地应用。配置不同的载入模块之后必须重启生效。目前对于Floodlight模块的配置都是通过需在启动时加载的一个配置文件的修改实现的。简单的说,用户可以通过以下步骤,找到或控制Floodlight当前的配置:
?打开 src/main/resources/META-
INF/services/net.floodlightcontroller.core.module.IFloodlightModule文件,就可以查看所有在floodlight.jar二进制编译中的模块编译。
?打开src/main/resources/floodlightdefault.properties文件或者其他自定义属性文件,查看
文件中选择加载/运行模块。这些文件时是配置某些启动时参数的地方,例如:REST
API服务和WEB UI端口(8080)、交换机连接OpenFlow端口(6633)、默认的超时值等。
?如果在Eclipse或命令行(java -jar floodlight.jar)运行Floodlight,默认情况下加载默
认属性文件。详细情况可以查看程序参数包括 -cf
some_properties_file文件。
?如果在Floodlight-vm上运行的Floodlight,floodlight.jar是按照
/opt/floodlight/floodlight/configuration/floodlight.properties instead of
floodlightdefault.properties文件,作为服务载入
?如果需要修改默认值,停止Floodlight,更新以上所说的属性文件并重启。
?如果自定义新的模块更新上述的两个文件并重启生效。
虽然大多数的应用都是按照默认属性配置运行,但是下面的应用程序需要一组特定的模块,因此需要一个特定的配置文件(由于某些模块之间不兼容)来运行。
?OpenStack Quantum plugin:需要和src/main/resources/quantum.properties文件一起运
?Forwarding和StaticFlowEntryPusher:这两个模块都是默认加载的
,但有时你只需要加载其中的一个来实现应用程序的功能。例如,你想要一个完全自动配置的网络并且不会有转发反应,因此只需要StaticFlowEntryPusher模块而禁止Forwarding模块。控制日志级别
在控制台显示的调试信息有时是很有帮助的,但有时又会显得十分繁杂。Floodlight使用org.slf4j.Logger模块,将日志信息划分不同的等级。同时,日志等级是可控的。在默认情况下,Floodlight显示了所有的日志等级。为了控制日志等级,可以向JVM传递以下参数:
java -Dlogback.configurationFile=logback.xml -jar floodlight.jar
如果实在Eclipse下运行的Floodlight,点击运行-&运行/调试配置-&参数-&VM参数,在这里添加-Dlogback.configurationFile=logback.xml
Xml文件已经包含在Floodlight根目录中。
因此调试信息并不会出现在控制台中。你可以在logxml文件中指定INFO,WARN和DEBUG的级别。
监听地址和端口配置
Floodlight REST API
虚拟网络过滤器的REST API
包含各类专业文献、中学教育、幼儿教育、小学教育、应用写作文书、文学作品欣赏、生活休闲娱乐、外语学习资料、10Floodlight开发者文档(译文)等内容。 2127人阅读
openflow(2)
floodlight
元旦的时候发现居然更新了,吓坏我了。是年月更新的,然后在年月日连续发布了和。……
根据来看,主要最大的更新在于添加了对于的支持。虽然我尚未验证(后续会验证)对的支持程度,但是中的这句话:“&and&work&with&OpenFlow&1.3&features&such&as&groups&and&meters.”。我猜测大概是能够识别组表和计量表,但是不作处理。……还有就是以往一些小的修复,最直观的就是页面的改进。拓扑结构、、流表等信息不再像以往一样显不显示得看脸,可以实时准确的显示出来。
下面是具体的添加模块的实验。
导入工程:
从上直接拉下来的代码是没法直接导入到中的,需要添加文件和文件:
Project文件:
&?xml version=&1.0& encoding=&UTF-8&?&
&projectDescription&
&name&floodlight&/name&
&comment&&/comment&
&projects&
&/projects&
&buildSpec&
&buildCommand&
&name&org.python.pydev.PyDevBuilder&/name&
&arguments&
&/arguments&
&/buildCommand&
&buildCommand&
&name&org.eclipse.jdt.core.javabuilder&/name&
&arguments&
&/arguments&
&/buildCommand&
&/buildSpec&
&nature&org.eclipse.jdt.core.javanature&/nature&
&nature&org.python.pydev.pythonNature&/nature&
&/natures&
&/projectDescription&
Classpath文件:
&?xml version=&1.0& encoding=&UTF-8&?&
&classpath&
&classpathentry kind=&src& output=&target/bin& path=&src/main/java&/&
&classpathentry kind=&src& path=&src/main/resources&/&
&classpathentry kind=&src& output=&target/bin-test& path=&src/test/java&/&
&classpathentry kind=&src& path=&src/test/resources&/&
&classpathentry kind=&src& output=&target/bin& path=&lib/gen-java&/&
&classpathentry exported=&true& kind=&lib& path=&lib/args4j-2.0.16.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/cglib-nodep-2.2.2.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/concurrentlinkedhashmap-lru-1.2.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/derby-10.9.1.0.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/findbugs-annotations-2.0.1.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/findbugs-jsr305-2.0.1.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/guava-13.0.1.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jackson-annotations-2.1.4.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jackson-core-2.1.4.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jackson-databind-2.1.4.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jackson-dataformat-csv-2.1.4.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jackson-dataformat-smile-2.1.4.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jackson-dataformat-xml-2.1.4.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jackson-dataformat-yaml-2.1.4.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/junit-4.8.2.jar& sourcepath=&C:/Users/dell/.m2/repository/junit/junit/4.8.2/junit-4.8.2-sources.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/jython-2.5.2.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/libthrift-0.9.0.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/logback-classic-1.0.0.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/logback-core-1.0.0.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/netty-3.2.6.Final.jar& sourcepath=&C:/Users/dell/.m2/repository/org/jboss/netty/netty/3.2.6.Final/netty-3.2.6.Final-sources.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/objenesis-1.2.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/org.easymock-3.1.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/org.restlet-2.2M3.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/org.restlet.ext.jackson-2.2M3.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/org.restlet.ext.simple-2.2M3.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/org.restlet.ext.slf4j-2.2M3.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/simple-5.1.1.jar&/&
&classpathentry exported=&true& kind=&lib& path=&lib/slf4j-api-1.6.4.jar&/&
&classpathentry kind=&lib& path=&lib/asm-3.0.jar&/&
&classpathentry kind=&lib& path=&lib/asm-tree-3.0.jar&/&
&classpathentry kind=&lib& path=&lib/cobertura-1.9.4.1.jar&/&
&classpathentry kind=&lib& path=&lib/hamcrest-core-1.3.jar&/&
&classpathentry kind=&lib& path=&lib/hamcrest-integration-1.3.jar&/&
&classpathentry kind=&lib& path=&lib/hamcrest-library-1.3.jar&/&
&classpathentry kind=&lib& path=&lib/j3dutils.jar&/&
&classpathentry kind=&lib& path=&lib/jdeb-1.0.1.jar&/&
&classpathentry kind=&lib& path=&lib/log4j-1.2.9.jar&/&
&classpathentry kind=&lib& path=&lib/openflowj-0.9.0-SNAPSHOT-javadoc.jar&/&
&classpathentry kind=&lib& path=&lib/openflowj-0.9.0-SNAPSHOT-sources.jar&/&
&classpathentry kind=&lib& path=&lib/openflowj-0.9.0-SNAPSHOT.jar&/&
&classpathentry kind=&lib& path=&lib/packetstreamer-thrift.jar&/&
&classpathentry kind=&lib& path=&lib/oro/jakarta-oro-2.0.8.jar&/&
&classpathentry exported=&true& kind=&con& path=&org.eclipse.jdt.launching.JRE_CONTAINER&/&
&classpathentry kind=&output& path=&target/bin&/&
&/classpath&
然后就可以作为普通的项目导入即可。
实验过程:
这里的实验做的是对包的数量进行统计并打印到控制台,功能单一,但能体现出添加新模块的整个流程。
1.添加新服务接口
首先需要定义新加模块服务的接口:
package net.floodlightcontroller.
import net.floodlightcontroller.core.module.IFloodlightS
* The service registry
* @author yangshuai
public interface IPktinHistoryService extends IFloodlightService {
* 用于统计结果
public long getPackINCount();
2.添加PktinHistory模块:因为这里添加的新模块的功能比较单一,只是统计floodlight运行后packet-in包的总数量,并且是持续累计计数的,所以只需在该接口中定义一个用于计算的方法就可以了。
定义PktinHistory模块:
package net.floodlightcontroller.
import java.util.ArrayL
import java.util.C
import java.util.HashM
import java.util.M
import java.util.concurrent.atomic.AtomicL
import org.projectfloodlight.openflow.protocol.OFM
import org.projectfloodlight.openflow.protocol.OFT
import org.slf4j.L
import org.slf4j.LoggerF
import net.floodlightcontroller.core.FloodlightC
import net.floodlightcontroller.core.IFloodlightProviderS
import net.floodlightcontroller.core.IOFMessageL
import net.floodlightcontroller.core.IOFS
import net.floodlightcontroller.core.module.FloodlightModuleC
import net.floodlightcontroller.core.module.FloodlightModuleE
import net.floodlightcontroller.core.module.IFloodlightM
import net.floodlightcontroller.core.module.IFloodlightS
import net.floodlightcontroller.restserver.IRestApiS
*@author yangshuai
public class PktinHistory implements
IOFMessageListener,IFloodlightModule,IPktinHistoryService{
protected static Logger log = LoggerFactory.getLogger(PktinHistory.class);
protected IFloodlightProviderService FloodlightP
protected IRestApiService restA
private AtomicLong PACKET_IN_COUNT = new AtomicLong() ;
public String getName() {
return &PktinHistory& ;
public boolean isCallbackOrderingPrereq(OFType type, String name) {
// TODO Auto-generated method stub
public boolean isCallbackOrderingPostreq(OFType type, String name) {
// TODO Auto-generated method stub
public long getPackINCount() {
return PACKET_IN_COUNT.get();
public Collection&Class&? extends IFloodlightService&& getModuleServices() {
Collection&Class&? extends IFloodlightService&& l =
new ArrayList&Class&? extends IFloodlightService&&();
l.add(IPktinHistoryService.class);
public Map&Class&? extends IFloodlightService&, IFloodlightService& getServiceImpls() {
Map&Class&? extends IFloodlightService&,IFloodlightService& m =
HashMap&Class&? extends IFloodlightService&,IFloodlightService&();
m.put(IPktinHistoryService.class,this);
public Collection&Class&? extends IFloodlightService&& getModuleDependencies() {
Collection&Class&? extends IFloodlightService&& l =
new ArrayList&Class&? extends IFloodlightService&&() ;
l.add(IFloodlightProviderService.class);
l.add(IRestApiService.class);
public void init(FloodlightModuleContext context)
throws FloodlightModuleException {
FloodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
restApi = context.getServiceImpl(IRestApiService.class) ;
public void startUp(FloodlightModuleContext context)
throws FloodlightModuleException {
FloodlightProvider.addOFMessageListener(OFType.PACKET_IN,this) ;
public net.floodlightcontroller.mand receive(
IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
long count = PACKET_IN_COUNT.incrementAndGet() ;
(&The total count of packet-in Messages are& + count);
return Command.CONTINUE ;
在floodlight中所有的模块都必须实现IFloodlightModule接口,而这里新添加的模块需要监听数据包,所以也需要实现IOFMessageListener接口。IOFMessageListener接口用于监听Packet-in消息,并记录消息递增数量,IPktinHistoryService接口是业务查询接口,提供Packet-in数据分组统计结果查询服务,IFloodLightModule接口标识该类是一个floodlight模块,继承该接口的类会在floodlight启动过程中以模块形式加载。该类文件可以随意添加到任何包中,为了方便管理和演示,这里将所有添加该模块所新建的文件全都放在了新建包net.floodlightcontroller.statics中。这个路劲在后面修改配置文件中仍然会使用到。
3.rest资源定义
在完成模块的定义之后,需要对rest服务资源进行定义,这里将类名定义为:PktInHistoryResource,继承抽象类ServerResource(ServerResource是Java轻量级REST框架Restlet的抽象类),并实现业务逻辑。该步主要功能是将Packet-in统计接口包装为REST资源便于后续资源绑定。
package net.floodlightcontroller.
import java.util.HashM
import org.restlet.resource.G
import org.restlet.resource.ServerR
*@author yangshuai
public class PktInHistoryResource extends ServerResource{
@Get(&json&)
public HashMap&String, String& retrieve(){
IPktinHistoryService pihr = (IPktinHistoryService) getContext()
.getAttributes().get(IPktinHistoryService.class.getCanonicalName());
long count = pihr.getPackINCount();
HashMap&String, String& resp = new HashMap&String, String&() ;
resp.put(&Total&, Long.toString(count)) ;
4.绑定url与rest资源
接着定义PktInHistoryWebRoutable类,将上步定义的PktInHistoryResource资源与访问路径绑定。该类中定义的路径包括外部获取该REST资源的基本路径和相对路径。
package net.floodlightcontroller.
import net.floodlightcontroller.restserver.RestletR
import org.restlet.C
import org.restlet.R
import org.restlet.routing.R
*@author yangshuai
public class PktInHistoryWebRoutable implements RestletRoutable{
public Restlet getRestlet(Context context){
Router router =new Router(context) ;
router.attach(&/pktinhistory/json&, PktInHistoryResource.class) ;
public String basePath(){
return &/vm/statics& ;
5.资源发布&
资源绑定相应路径后需要在REST服务中发布,因此还需要在PktinHistory的startUp方法中注册PktInHistoryWebRoutable,表明有新的资源加入REST服务。
public void init(FloodlightModuleContext context)
throws FloodlightModuleException {
FloodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
restApi = context.getServiceImpl(IRestApiService.class) ;
6.定义完上述源码后还需要在配置文件中指定新增模块名,该配置文件为resources/META-INF/services/net.FloodLight.core.module.IFloodLightModule,这里就是添加net.FloodLightcontroller.statics.PktinHistory模块配置信息。该配置文件是FloodLight模块加载系统中加载模块类的依据,用于告知控制器要加载那些模块。&
7.除上述配置外,还需要在resources/floodlightdefault.properties中的floodlight.modules配置参数后追加新增模块名(net.FloodLight.controller.statics.PktinHistory&注:这里就要根据添加的PktinHistory&类的具体路径进行修改),表明该配置启动时必须加载。
实验成果截图:
在floodlight的显示界面上的监听端口为,在以前的版本中,连接到远程控制器时指定的端口号也是。但是在版本的测试时,是使用端口连接上的。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:54796次
排名:千里之外
原创:20篇
评论:34条

我要回帖

更多关于 camtasia studio 的文章

 

随机推荐