Fixed YANG - GetAsyncReply 43/1343/2
authormichal.polkorab <michal.polkorab@pantheon.sk>
Mon, 23 Sep 2013 12:24:05 +0000 (14:24 +0200)
committermichal.polkorab <michal.polkorab@pantheon.sk>
Mon, 23 Sep 2013 12:38:51 +0000 (14:38 +0200)
Added creation of source artifact to pom.xml in api project
Implemented shutdown method in SwitchConnectionProvider
Renamed CommunicationFacade interface to ConnectionFacade
Removed version field from ConnectionAdapter

Signed-off-by: michal.polkorab <michal.polkorab@pantheon.sk>
Change-Id: I44e411a3253f7bc0ed6be19945436efeb4ba20a1

openflow-protocol-api/pom.xml
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/connection/ConnectionAdapter.java
openflow-protocol-api/src/main/yang/openflow-protocol.yang
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/ConnectionAdapterFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/ConnectionAdapterImpl.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/ConnectionFacade.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/CommunicationFacade.java with 75% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/SwitchConnectionProviderImpl.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializer.java
openflow-protocol-spi/src/main/java/org/opendaylight/openflowjava/protocol/spi/connection/SwitchConnectionProvider.java

index 65374963bf59d81e5de587ca6eaae7ec9889508a..2b8a65c1cff6875270a8cdee5502ff5d0432e061 100644 (file)
                     </execution>\r
                 </executions>\r
             </plugin>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-source-plugin</artifactId>\r
+                <executions>\r
+                    <execution>\r
+                        <id>attach-sources</id>\r
+                        <phase>package</phase>\r
+                        <goals>\r
+                            <goal>jar-no-fork</goal>\r
+                        </goals>\r
+                    </execution>\r
+                </executions>\r
+            </plugin>\r
         </plugins>\r
         <pluginManagement>\r
             <plugins>\r
index 888a73910a3baf08a2656d54e7dcbc5c8858cd39..a955d13547130dfaf1c49dbbf1173614cc0231c0 100644 (file)
@@ -34,11 +34,5 @@ public interface ConnectionAdapter extends OpenflowProtocolService {
      * @param messageListener here will be pushed all messages from switch
      */
     public void setMessageListener(OpenflowProtocolListener messageListener);
-    
-    /**
-     * @param version version of OpenFlow protocol to be used for communication with switch 
-     * (set after version negotiation) - in wire protocol format e.g. 4 (or 0x04) for OF 1.3   
-     * 
-     */
-    public void setVersion(int version);
+
 }
index 37fb5ae1981224b3e9e62ceaeac0e800fa70dc4d..114d5119342a626d60907151d1063dd760ed9892 100644 (file)
@@ -660,14 +660,20 @@ module openflow-protocol {
 
                 uses ofHeader;
                 
-                leaf-list packet-in-mask {
-                    type oft:packet-in-reason;
+                list packet-in-mask {
+                    leaf-list mask {
+                        type oft:packet-in-reason;
+                    }
                 }
-                leaf-list port-status-mask {
-                    type oft:port-reason;
+                list port-status-mask {
+                    leaf-list mask {
+                        type oft:port-reason;
+                    }
                 }
-                leaf-list flow-removed-mask {
-                    type oft:flow-removed-reason;
+                list flow-removed-mask {
+                    leaf-list mask {
+                        type oft:flow-removed-reason;
+                    }
                 }
             } 
             grouping set-async {
index 3304817775502b05a8ad41d0c53867ec4963532c..d0b25e5d3cb1829095825f36ed0c7e10a339b60f 100644 (file)
@@ -20,7 +20,7 @@ public abstract class ConnectionAdapterFactory {
      * @param ch
      * @return connection adapter tcp-implementation
      */
-    public static CommunicationFacade createConnectionAdapter(SocketChannel ch) {
+    public static ConnectionFacade createConnectionAdapter(SocketChannel ch) {
         ConnectionAdapterImpl connectionAdapter = new ConnectionAdapterImpl();
         connectionAdapter.setChannel(ch);
         return connectionAdapter;
index 9457373d3ac7ee80551fd1174a4a6544d6cc334c..d07b588797c5ab14cc235d11fedfbf4ffe090344 100644 (file)
@@ -74,7 +74,7 @@ import com.google.common.util.concurrent.SettableFuture;
  * @author mirehak
  * @author michal.polkorab
  */
-public class ConnectionAdapterImpl implements CommunicationFacade {
+public class ConnectionAdapterImpl implements ConnectionFacade {
     
     /** after this time, rpc future response objects will be thrown away (in minutes) */
     public static final int RPC_RESPONSE_EXPIRATION = 1;
@@ -86,7 +86,6 @@ public class ConnectionAdapterImpl implements CommunicationFacade {
     private static final String TAG = "OPENFLOW";
     private Channel channel;
     private OpenflowProtocolListener messageListener;
-    private int version;
     /** expiring cache for future rpcResponses */
     protected Cache<RpcResponseKey, SettableFuture<?>> responseCache;
     
@@ -240,11 +239,6 @@ public class ConnectionAdapterImpl implements CommunicationFacade {
     
     @Override
     public void consume(DataObject message) {
-        if (message == null) {
-            LOG.error("message is null");
-        } else {
-            LOG.debug("message is ok");
-        }
         if (message instanceof Notification) {
             if (message instanceof EchoRequestMessage) {
                 messageListener.onEchoRequestMessage((EchoRequestMessage) message);
@@ -472,12 +466,4 @@ public class ConnectionAdapterImpl implements CommunicationFacade {
         return (SettableFuture<RpcResult<?>>) responseCache.getIfPresent(key);
     }
 
-    /* (non-Javadoc)
-     * @see org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter#setVersion(int)
-     */
-    @Override
-    public void setVersion(int version) {
-        this.version = version;
-    }
-
 }
@@ -7,7 +7,7 @@ import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
  * @author michal.polkorab\r
  *\r
  */\r
-public interface CommunicationFacade extends MessageConsumer, ConnectionAdapter {\r
+public interface ConnectionFacade extends MessageConsumer, ConnectionAdapter {\r
 \r
  // empty unifying superinterface\r
 }\r
index 1ce61d19a693e968f263bc7fd44918d89eca48b9..3a540449e4f65e657850318dadcb66ce12e151c1 100644 (file)
@@ -57,12 +57,27 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider {
     }
 
     @Override
-    public Future<Boolean> shutdown() {
+    public Future<List<Boolean>> shutdown() {
         LOG.debug("shutdown summoned");
-        for (ServerFacade server : serverLot) {
-            server.shutdown();
+        ListenableFuture<List<Boolean>> result = SettableFuture.create();
+        try {
+            List<ListenableFuture<Boolean>> shutdownChain = new ArrayList<>();
+            for (ServerFacade server : serverLot) {
+                ListenableFuture<Boolean> shutdownFuture = server.shutdown();
+                shutdownChain.add(shutdownFuture);
+            }
+            
+            if (!shutdownChain.isEmpty()) {
+                result = Futures.allAsList(shutdownChain);
+            } else {
+                throw new IllegalStateException("no servers configured");
+            }
+        } catch (Exception e) {
+            SettableFuture<List<Boolean>> exFuture = SettableFuture.create();
+            exFuture.setException(e);
+            result = exFuture;
         }
-        return null;
+        return result;
     }
 
     @Override
index 27ecc2c562331f8197ce59fe9d63a0ee6d91d804..2b1badaf917b04f20ae1daf0da8cb25b4adb1c7a 100644 (file)
@@ -8,7 +8,7 @@ import io.netty.channel.socket.SocketChannel;
 import java.util.Iterator;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.impl.connection.CommunicationFacade;\r
+import org.opendaylight.openflowjava.protocol.impl.connection.ConnectionFacade;\r
 import org.opendaylight.openflowjava.protocol.impl.connection.ConnectionAdapterFactory;\r
 import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;\r
 \r
@@ -32,7 +32,7 @@ public class PublishingChannelInitializer extends ChannelInitializer<SocketChann
     protected void initChannel(SocketChannel ch) throws Exception {\r
         // TODO - call switchConnectionHandler accept first\r
         allChannels.add(ch);\r
-        CommunicationFacade connectionAdapter = null;\r
+        ConnectionFacade connectionAdapter = null;\r
         if (switchConnectionHandler != null) {\r
             connectionAdapter = ConnectionAdapterFactory.createConnectionAdapter(ch);\r
             switchConnectionHandler.onSwitchConnected(connectionAdapter);\r
index c6e509e3e53453e49a57e50f0198f80bb1546969..6e04b94c0ae11748b46b74b2b3878219feb5750c 100644 (file)
@@ -37,7 +37,7 @@ public interface SwitchConnectionProvider {
      * stop listening to switches
      * @return future, triggered to true, when all listening channels are down
      */
-    public Future<Boolean> shutdown();
+    public Future<List<Boolean>> shutdown();
     
     /**
      * @param switchConHandler instance being informed when new switch connects