VOL-376 : Fix for Null Pointer Exception when subscriber is not provisioned
Patchet contains
1. Fix for Null Pointer Exception when subscriber is not provisioned in Sadis
2. README.md updates for Sadis configuration of subscriber and device
3. Correcting log levels of some of the logs

Change-Id: I59270faff77d05013a4313629c60911148533e19
diff --git a/README.md b/README.md
index e9dbda4..ce32243 100644
--- a/README.md
+++ b/README.md
@@ -51,3 +51,29 @@
 "sample" : This is a sample customization wherein specific RADIUS attributes and filled with values from `Sadis` Service. The src MAC and src IP of the RADIUS messages are set according to the OLT device (from which the EAP Start message is received) configured in `Sadis`
 
 More customizers might be added to AAA App later which can fill Subscriber specific atrributes into the RADIUS attributes/messages by querying data from `Sadis`. The key to get data from Sadis is the PortName of the Port from which EAP messages are received.
+
+# Example configuration of Sadis
+```sh
+   "org.opencord.sadis" : {
+      "sadis" : {
+        "integration" : {
+          "cache" : {
+            "enabled" : true,
+            "maxsize" : 50,
+            "ttl" : "PT1m"
+          }
+        },
+        "entries" : [ {
+          "id" : "uni-128", # (This is an entry for a subscriber) Same as the portName of the Port as seen in onos ports command
+          "cTag" : 2, # C-tag of the subscriber
+          "sTag" : 2, # S-tag of the subscriber
+          "nasPortId" : "uni-128"  # NAS Port Id of the subscriber, could be different from the id above
+        }, {
+          "id" : "1d3eafb52e4e44b08818ab9ebaf7c0d4", # (This is an entry for an OLT device) Same as the serial of the OLT logical device as seen in the onos devices command
+          "hardwareIdentifier" : "00:1b:22:00:b1:78", # MAC address to be used for this OLT
+          "ipAddress" : "192.168.1.252", # IP address to be used for this OLT
+          "nasId" : "B100-NASID" # NAS ID to be used for this OLT
+        } ]
+      }
+    }
+ ```
diff --git a/src/main/java/org/opencord/aaa/AaaManager.java b/src/main/java/org/opencord/aaa/AaaManager.java
index 2f885db..1df4574 100755
--- a/src/main/java/org/opencord/aaa/AaaManager.java
+++ b/src/main/java/org/opencord/aaa/AaaManager.java
@@ -423,6 +423,9 @@
                             subsService.get(nasPortId);
                     if (subscriber != null) {
                         stateMachine = new StateMachine(sessionId, subscriber.cTag());
+                    } else {
+                        log.error("Could not create new state machine for {}", nasPortId);
+                        return;
                     }
                 } else {
                     stateMachine = new StateMachine(sessionId, VlanId.vlanId((short) 0));
diff --git a/src/main/java/org/opencord/aaa/PortBasedRadiusCommunicator.java b/src/main/java/org/opencord/aaa/PortBasedRadiusCommunicator.java
index 6e256b7..8e93777 100755
--- a/src/main/java/org/opencord/aaa/PortBasedRadiusCommunicator.java
+++ b/src/main/java/org/opencord/aaa/PortBasedRadiusCommunicator.java
@@ -129,7 +129,7 @@
         mastershipService.addListener(changeListener);
         deviceService.addListener(deviceListener);
 
-        log.error("Created PortBased");
+        log.info("Created PortBased");
     }
 
     private void initializeLocalState() {
@@ -142,13 +142,12 @@
                         if (deviceService.isAvailable(cp.deviceId())) {
                             radiusServerConnectPoint = cp;
                         }
-                        log.warn("RADIUS connectPoint selected is {}", cp);
                         break;
                     }
                 }
             }
 
-            log.warn("RADIUS connectPoint in initializeLocalState is {}", radiusServerConnectPoint);
+            log.info("RADIUS connectPoint in initializeLocalState is {}", radiusServerConnectPoint);
 
             if (radiusServerConnectPoint == null) {
                 log.error("Master of none, can't send radius Message to server");
@@ -248,7 +247,7 @@
         SubscriberAndDeviceInformation deviceInfo = subsService.get(serialNo);
 
         if (deviceInfo == null) {
-            log.error("No Device found with SN {}", serialNo);
+            log.warn("No Device found with SN {}", serialNo);
             return;
         }
         ipToSnMap.put(deviceInfo.ipAddress(), serialNo);
@@ -325,7 +324,7 @@
         }
         MacAddress senderMac = subsService.get(serialNo).hardwareIdentifier();
         if (senderMac == null) {
-            log.error("ARP resolution, MAC address not found for SN {}", serialNo);
+            log.warn("ARP resolution, MAC address not found for SN {}", serialNo);
             return;
         }
 
diff --git a/src/main/java/org/opencord/aaa/SocketBasedRadiusCommunicator.java b/src/main/java/org/opencord/aaa/SocketBasedRadiusCommunicator.java
index 1f046e4..766f471 100755
--- a/src/main/java/org/opencord/aaa/SocketBasedRadiusCommunicator.java
+++ b/src/main/java/org/opencord/aaa/SocketBasedRadiusCommunicator.java
@@ -132,7 +132,7 @@
                             radiusIpAddress, radiusServerPort);
 
             socket.send(packet);
-            log.warn("Packet sent to Radius Server using socket packet = {}", packet);
+            log.info("Packet sent to Radius Server using socket packet = {}", packet);
         } catch (IOException e) {
             log.info("Cannot send packet to RADIUS server", e);
         }