Fix to deal with exception cases in case of OpenstackNetworkEvent.

Change-Id: I3a1d3c5a6f8ac5822d6f0eb62d5164ecea3c51a3
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java
index 514425b..2749962 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackSwitchingHandler.java
@@ -428,21 +428,24 @@
 
         @Override
         public void event(OpenstackNetworkEvent event) {
+            try {
+                if ((event.type() == OPENSTACK_NETWORK_CREATED ||
+                        event.type() == OPENSTACK_NETWORK_UPDATED) && !event.subject().isAdminStateUp()) {
+                    setNetworkAdminRules(event.subject(), true);
+                } else if ((event.type() == OPENSTACK_NETWORK_UPDATED && event.subject().isAdminStateUp()) ||
+                        (event.type() == OPENSTACK_NETWORK_REMOVED && !event.subject().isAdminStateUp())) {
+                    setNetworkAdminRules(event.subject(), false);
+                }
 
-            if ((event.type() == OPENSTACK_NETWORK_CREATED ||
-                    event.type() == OPENSTACK_NETWORK_UPDATED) && !event.subject().isAdminStateUp()) {
-                setNetworkAdminRules(event.subject(), true);
-            } else if ((event.type() == OPENSTACK_NETWORK_UPDATED && event.subject().isAdminStateUp()) ||
-                    (event.type() == OPENSTACK_NETWORK_REMOVED && !event.subject().isAdminStateUp())) {
-                setNetworkAdminRules(event.subject(), false);
-            }
-
-            if ((event.type() == OPENSTACK_PORT_CREATED ||
-                    event.type() == OPENSTACK_PORT_UPDATED) && !event.port().isAdminStateUp()) {
-                setPortAdminRules(event.port(), true);
-            } else if ((event.type() == OPENSTACK_PORT_UPDATED && event.port().isAdminStateUp()) ||
-                    (event.type() == OPENSTACK_PORT_REMOVED && !event.port().isAdminStateUp())) {
-                setPortAdminRules(event.port(), false);
+                if ((event.type() == OPENSTACK_PORT_CREATED ||
+                        event.type() == OPENSTACK_PORT_UPDATED) && !event.port().isAdminStateUp()) {
+                    setPortAdminRules(event.port(), true);
+                } else if ((event.type() == OPENSTACK_PORT_UPDATED && event.port().isAdminStateUp()) ||
+                        (event.type() == OPENSTACK_PORT_REMOVED && !event.port().isAdminStateUp())) {
+                    setPortAdminRules(event.port(), false);
+                }
+            } catch (Exception e) {
+                log.error("Exception occurred while processing OpenstackNetworkEvent because of {}", e.toString());
             }
         }
     }