首页 文章

OpenDaylight:从Open vSwitch到Controller没有OpenFlow连接

提问于
浏览
0

控制器和打开vswitch之间没有连接 .

opendaylight-user@root>info
Karaf
  Karaf version               4.0.10
  Karaf home                  /opt/odl
  Karaf base                  /opt/odl
  OSGi Framework              org.eclipse.osgi-3.10.101.v20150820-1432

JVM
  Java Virtual Machine        OpenJDK 64-Bit Server VM version 25.144-b01
  Version                     1.8.0_144
  Vendor                      Oracle Corporation
  Pid                         4312
  Uptime                      19 hours 16 minutes
  Total compile time          3 minutes
Threads
  Live threads                218
  Daemon threads              99
  Peak                        221
  Total started               8170
Memory
  Current heap size           621,509 kbytes
  Maximum heap size           1,864,192 kbytes
  Committed heap size         1,030,144 kbytes
  Pending objects             0
  Garbage collector           Name = 'PS Scavenge', Collections = 533, Time = 12.404 seconds
  Garbage collector           Name = 'PS MarkSweep', Collections = 24, Time = 15.571 seconds
Classes
  Current classes loaded      23,639
  Total classes loaded        23,827
  Total classes unloaded      188
Operating system
  Name                        Linux version 3.10.0-514.21.1.el7.x86_64
  Architecture                amd64
  Processors                  4
opendaylight-user@root>

OpenFlow会话统计显示 . 10.10.10.10是交换机的IP地址:

opendaylight-user@root>ofp:show-session-stats
SESSION : /10.10.10.10:35616
 CONNECTION_DISCONNECTED_BY_DEVICE : 1
SESSION : /10.10.10.10:35592
 CONNECTION_DISCONNECTED_BY_DEVICE : 1
SESSION : /10.10.10.10:35608
 CONNECTION_DISCONNECTED_BY_DEVICE : 1
SESSION : /10.10.10.10:51110
 CONNECTION_DISCONNECTED_BY_DEVICE : 1
SESSION : /10.10.10.10:35610
 CONNECTION_DISCONNECTED_BY_DEVICE : 1
SESSION : /10.10.10.10:35612
 CONNECTION_DISCONNECTED_BY_DEVICE : 1
SESSION : /10.10.10.10:35614
 CONNECTION_DISCONNECTED_BY_DEVICE : 1
opendaylight-user@root>

日志显示以下行:

2018-02-26 11:54:08,732 | DEBUG | pool-58-thread-1 | LLDPSpeaker                      | 296 - org.opendaylight.openflowplugin.applications.lldp-speaker - 0.5.1 | Sending LLDP frames to 0 ports...
2018-02-26 11:54:10,092 | DEBUG | ntLoopGroup-15-7 | nflowProtocolListenerInitialImpl | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | echo request received: 0
2018-02-26 11:54:13,732 | DEBUG | pool-58-thread-1 | LLDPSpeaker                      | 296 - org.opendaylight.openflowplugin.applications.lldp-speaker - 0.5.1 | Sending LLDP frames to 0 ports...
2018-02-26 11:54:15,092 | DEBUG | ntLoopGroup-15-7 | nflowProtocolListenerInitialImpl | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | echo request received: 0
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH_TRANSLATE_IN_SUCCESS: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH_TRANSLATE_OUT_SUCCESS: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH_TRANSLATE_SRC_FAILURE: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH_PACKET_IN_LIMIT_REACHED_AND_DROPPED: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH_NOTIFICATION_REJECTED: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH_PUBLISHED_SUCCESS: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | FROM_SWITCH_PUBLISHED_FAILURE: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_ENTERED: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_DISREGARDED: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_RESERVATION_REJECTED: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_READY_FOR_SUBMIT: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_SUBMIT_SUCCESS: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_SUBMIT_SUCCESS_NO_RESPONSE: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_SUBMIT_FAILURE: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | TO_SWITCH_SUBMIT_ERROR: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | REQUEST_STACK_FREED: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | OFJ_BACKPRESSURE_ON: no activity detected
2018-02-26 11:54:16,073 | DEBUG | pool-75-thread-1 | MessageIntelligenceAgencyImpl    | 305 - org.opendaylight.openflowplugin.impl - 0.5.1 | OFJ_BACKPRESSURE_OFF: no activity detected

OpenFlow拓扑中没有节点:

opendaylight-user@root>openflow:getallnodes
No node is connected yet
opendaylight-user@root>

在线上,我看到控制器和交换机之间的OpenFlow数据包:

Frame 1: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) on interface 0
Internet Protocol Version 4, Src: 10.10.10.10 (10.10.10.10), Dst: 10.10.10.20 (10.10.10.20)
Transmission Control Protocol, Src Port: 35338 (35338), Dst Port: openflow (6653), Seq: 1, Ack: 1, Len: 8
Openflow Protocol
    Header
        Version: 0x04
        Type: Echo request (SM) - OFPT_ECHO_REQUEST (2)
        Length: 8
        Transaction ID: 0

Frame 2: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) on interface 0
Internet Protocol Version 4, Src: 10.10.10.20 (10.10.10.20), Dst: 10.10.10.10 (10.10.10.10)
Transmission Control Protocol, Src Port: openflow (6653), Dst Port: 35338 (35338), Seq: 1, Ack: 9, Len: 8
Openflow Protocol
    Header
        Version: 0x04
        Type: Echo reply (SM) - OFPT_ECHO_REPLY (3)
        Length: 8
        Transaction ID: 0

Frame 3: 66 bytes on wire (528 bits), 66 bytes captured (528 bits) on interface 0
Internet Protocol Version 4, Src: 10.10.10.10 (10.10.10.10), Dst: 10.10.10.20 (10.10.10.20)
Transmission Control Protocol, Src Port: 35338 (35338), Dst Port: openflow (6653), Seq: 9, Ack: 9, Len: 0
    Flags: 0x010 (ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgment: Set
        .... .... 0... = Push: Not set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
    Options: (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
        No-Operation (NOP)
            Type: 1
                0... .... = Copy on fragmentation: No
                .00. .... = Class: Control (0)
                ...0 0001 = Number: No-Operation (NOP) (1)
        Timestamps: TSval 140811003, TSecr 165720510
            Kind: Timestamp (8)
            Length: 10
            Timestamp value: 140811003
            Timestamp echo reply: 165720510

现在,在Open vSwitch端:

# ovs-vsctl show
934472aa-72ca-4f61-834c-a86bd41a9b27
    Manager "tcp:10.10.10.20:6640"
        is_connected: true
    Bridge "vsw0"
        Controller "tcp:10.10.10.20:6653"
            is_connected: true
        Port "339bfa2f6b7b4_l"
            Interface "339bfa2f6b7b4_l"
        Port "0de326ec0ace4_l"
            Interface "0de326ec0ace4_l"
        Port "vsw0"
            Interface "vsw0"
                type: internal
    ovs_version: "2.9.0"

控制器从ACTIVE变为IDLE:

# ovs-vsctl list controller
_uuid               : ac3f5c94-624a-47ce-90c3-782060e4ec3c
connection_mode     : []
controller_burst_limit: []
controller_rate_limit: []
enable_async_messages: []
external_ids        : {}
inactivity_probe    : []
is_connected        : true
local_gateway       : []
local_ip            : []
local_netmask       : []
max_backoff         : []
other_config        : {}
role                : other
status              : {sec_since_connect="42353", state=ACTIVE}
target              : "tcp:10.10.10.20:6653"

日志显示以下内容 .

2018-02-26T16:59:55.091Z|90890|vconn|DBG|tcp:10.10.10.20:6653: sent (Success): OFPT_ECHO_REQUEST (OF1.3) (xid=0x0): 0 bytes of payload
2018-02-26T16:59:55.092Z|90891|vconn|DBG|tcp:10.10.10.20:6653: received: OFPT_ECHO_REPLY (OF1.3) (xid=0x0): 0 bytes of payload
2018-02-26T16:59:55.092Z|90892|rconn|DBG|vsw0<->tcp:10.10.10.20:6653: entering ACTIVE
2018-02-26T17:00:00.091Z|90893|rconn|DBG|vsw0<->tcp:10.10.10.20:6653: idle 5 seconds, sending inactivity probe
2018-02-26T17:00:00.091Z|90894|rconn|DBG|vsw0<->tcp:10.10.10.20:6653: entering IDLE

任何想法为什么OF连接没有形成?

1 回答

  • 0

    问题是该桥没有使用OpenFlow 1.3协议设置 .

    ovs-vsctl set bridge vsw0 protocols=OpenFlow13
    

    在那之后, Session 出现了:

    opendaylight-user@root>ofp:show-session-stats
    SESSION : openflow:231865136161864
     CONNECTION_CREATED : 1
    opendaylight-user@root>
    

    控制器现在是“主”:

    # ovs-vsctl list controller
    _uuid               : ac3f5c94-624a-47ce-90c3-782060e4ec3c
    connection_mode     : []
    controller_burst_limit: []
    controller_rate_limit: []
    enable_async_messages: []
    external_ids        : {}
    inactivity_probe    : []
    is_connected        : true
    local_gateway       : []
    local_ip            : []
    local_netmask       : []
    max_backoff         : []
    other_config        : {}
    role                : master
    status              : {sec_since_connect="116", state=ACTIVE}
    target              : "tcp:10.10.10.20:6653"
    

相关问题