Merge "SAL Actions Property is OF1.0 specific"
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / core / internal / SwitchHandler.java
index 6e000022df12909e1f4facdcbcf4236d20d3fd69..6fddef06a8388a80a5278ce2f9a3234ae4461982 100644 (file)
@@ -359,8 +359,6 @@ public class SwitchHandler implements ISwitch {
         }
 
         if (msgs == null) {
-            logger.info("{} is down", this);
-            reportSwitchStateChange(false);
             return;
         }
         for (OFMessage msg : msgs) {
@@ -369,16 +367,15 @@ public class SwitchHandler implements ISwitch {
             OFType type = msg.getType();
             switch (type) {
             case HELLO:
-                // send feature request
-                OFMessage featureRequest = factory.getMessage(OFType.FEATURES_REQUEST);
-                asyncFastSend(featureRequest);
-                this.state = SwitchState.WAIT_FEATURES_REPLY;
-                startSwitchTimer();
+                sendFeaturesRequest();
                 break;
             case ECHO_REQUEST:
                 OFEchoReply echoReply = (OFEchoReply) factory.getMessage(OFType.ECHO_REPLY);
                 // respond immediately
                 asyncSendNow(echoReply, msg.getXid());
+
+                // send features request if not sent yet
+                sendFeaturesRequest();
                 break;
             case ECHO_REPLY:
                 this.probeSent = false;
@@ -507,6 +504,16 @@ public class SwitchHandler implements ISwitch {
         return this.sid;
     }
 
+    private void sendFeaturesRequest() {
+        if (!isOperational() && (this.state != SwitchState.WAIT_FEATURES_REPLY)) {
+            // send feature request
+            OFMessage featureRequest = factory.getMessage(OFType.FEATURES_REQUEST);
+            asyncFastSend(featureRequest);
+            this.state = SwitchState.WAIT_FEATURES_REPLY;
+            startSwitchTimer();
+        }
+    }
+
     private void processFeaturesReply(OFFeaturesReply reply) {
         if (this.state == SwitchState.WAIT_FEATURES_REPLY) {
             this.sid = reply.getDatapathId();