博文

目前显示的是 一月, 2017的博文

learning switch code(Analysis2)

TutorialL2Forwarding() close() onPacketReceived packetOut programL2Flow 初始化 logger,FLOOD_PORT_NUMBER, macTable (HashMap <String, NodeConnectorId>) ,function ("hub") ; registrations (List<Registration>) ,dataBroker,packetProcessingService TutorialL2Forwarding() 传参赋值,注册notification监听器 dataBroker  packetProcessingService  registrations  onPacketReceived() Get information of Node Reference,Id& NodeConnector Id, providing the NodeConnectorRef by notification.getIngress() From NodeId,FLOOD_PORT_NUMBER get NodeConnectorId,NodeConnectorRef for flooding Logic:           0. Ignore LLDP packets           1. If behaving as "hub", perform a PACKET_OUT with FLOOD action           2. Else if behaving as "learning switch",              2.1. Extract MAC addresses              2.2. Update MAC table wi...

learning switch code(Analysis)

PacketReceived.class public interface PacketReceived     extends     DataObject,  Augmentable<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived>,     RawPacket,     Notification {      public static final QName QNAME =  org.opendaylight.yangtools.yang.common.QName.create( "urn:opendaylight:packet:service",         "2013-07-09", "packet-received" ).intern();     ConnectionCookie getConnectionCookie();          FlowCookie getFlowCookie();          TableId getTableId();     java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketInReason> getPacketInReason();         Match getMatch(); } match This class represents the following YANG schema fragment defined in module packet-processing  (Source p...

Sample Application: The Learning Switch Functionality

图片
Create a HashMap called mac_to_port On packet_in, parse packet to get source and destination MAC addresses Store in a hashmap mapping between src_mac and in_port Lookup dst_mac in mac_to_port map to find next hop If next hop is found, create flow_mod and send Else, flood like hub. Processing a Packet: System View The application's workflow when processing a packet is shown in the following figure. Steps 1-3 in the figure show pkt_in processing. Steps 4-7 show pkt_out processing (flooding if not match is found). finally, Steps 8-12 show flow programming to the switch. The sequence details are as follows: A packet_in is sent from the switch to controller The OpenFlow java library parses the packet and translates it into an MD-SAL format governed by the OpenFlow protocol model; the OpenFlow 1.0/1.3 Plugin creates an  MD-SAL Notification   and publishes it into the MD-SAL. MD-SAL routes the notification to all registered consumers , in this case ...

Using the OpenDaylight SDN Controller with the Mininet Network Emulator

图片
进入karaf ubuntu@sdnhubvm:~/SDNHub_Opendaylight_Tutorial$ cd distribution/opendaylight-karaf/target/assembly ubuntu@sdnhubvm:~/SDNHub_Opendaylight_Tutorial/distribution/opendaylight-karaf/target/assembly$ ./bin/kar af  Mininet  ubuntu@sdnhubvm:~$ sudo mn --topo single,3 --mac --switch                         ovsk,protocols=OpenFlow13 --controller remote Dlux ifconfig查看ip地址 docker0那个地址 172.17.42.1:8181/index.html 登录到opendaylight的web界面 这时候看到,界面中有一个switch Topology Now we see the network topology in the OpenDaylight controller’s  topology  tab. 您可以看到由Mininet网络仿真器模拟的网络。 您可以通过在Mininet中构建具有不同属性的不同网络拓扑以及使用OpenDaylight在仿真网络上运行实验来测试OpenDaylight功能。 例如,您可以在Mininet中断开交换机之间的链路,以测试网络如何响应故障。 Nodes Click on the  Nodes  tab to see information about each switch in the network: Click on the  Node Connectors  link in each row to see information about each port on the switch:...

Mininet install and use

Ubuntu上安装Mininet详细: 1、更新软件 # apt-get update # apt-get upgrade 2、从github上获取Mininet源码。 #git clone git://github.com/mininet/mininet 3、获取完以后,查看当前获取的Mininet版本 #cd mininet #cat INSTALL 说明:在~/mininet目录下,我们可以通过git tag命令列出所有可用的Mininet版本,Mininet2.1.0p1及以后的版本可以原生支持OpenFlow1.3,所以我们这次安装的Mininet2.2.1版本支持OpenFlow1.3协议。 4、源码树获取成功以后,安装Mininet。 #mininet/util/install.sh[options] 这里典型的[options]主要有下面几种: “-a”:完整安装包括Mininet VM,还包括如Open vSwitch的依赖关系,以及像的OpenFlow Wireshark分离器和POX。默认情况下,这些工具将被安装在你的home目录中。 “-nfv”:安装Mininet、基于OpenFlow的交换机和Open vSwitch。 “-s mydir” :在其他选项使用前使用此选项可将源代码建立在一个指定的目录中,而不是在你的home目录。 所以,你可能会用到下面的某一个命令来安装Mininet: # install.sh –a ##完整安装(默认安装在home目录下) # install.sh -s mydir –a ##完整安装(安装在其他目录)  # install.sh –nfv ##安装Mininet+用户交换机+OVS(安装在home目录下) # install.sh -s mydir –nfv ##安装Mininet+用户交换机+OVS(安装在其他目录下) 这里选择的安装命令是: # mininet/util/install.sh –a 5、安装完成以后,通过简单的命令测试Mininet的基本功能。 #sudo mn --test pingall (From:http://www.linuxdiyf.com/li...