VOL-1848 API for setting and querying loglevel of api-server;
Add source-router to support routing UpdateLogLevel to cores;
Add logging endpoints to rocore

Change-Id: I89eea3599ea3006fe92e6917221cd1fd235ec5e4
diff --git a/afrouter/afrouter/affinity-router.go b/afrouter/afrouter/affinity-router.go
index 583d0a7..7a3168e 100644
--- a/afrouter/afrouter/affinity-router.go
+++ b/afrouter/afrouter/affinity-router.go
@@ -26,6 +26,7 @@
 	"strconv"
 )
 
+// TODO: Used in multiple routers, should move to common file
 const (
 	PKG_MTHD_PKG  int = 1
 	PKG_MTHD_MTHD int = 2
@@ -180,6 +181,7 @@
 	return false
 }
 
+// TODO: Used in multiple routers, should move to common file
 func needMethod(mthd string, conf *RouteConfig) bool {
 	for _, m := range conf.Methods {
 		if mthd == m {
@@ -265,7 +267,7 @@
 	}
 }
 
-func (ar AffinityRouter) Route(sel interface{}) *backend {
+func (ar AffinityRouter) Route(sel interface{}) (*backend, *connection) {
 	switch sl := sel.(type) {
 	case *requestFrame:
 		log.Debugf("Route called for requestFrame with method %s", sl.methodInfo.method)
@@ -276,17 +278,17 @@
 			log.Debugf("Method '%s' affinity binds on reply", sl.methodInfo.method)
 			// Just round robin route the southbound request
 			if *ar.currentBackend, err = ar.cluster.nextBackend(*ar.currentBackend, BackendSequenceRoundRobin); err == nil {
-				return *ar.currentBackend
+				return *ar.currentBackend, nil
 			} else {
 				sl.err = err
-				return nil
+				return nil, nil
 			}
 		}
 		// Not a south affinity binding method, proceed with north affinity binding.
 		if selector, err := ar.decodeProtoField(sl.payload, ar.methodMap[sl.methodInfo.method]); err == nil {
 			log.Debugf("Establishing affinity for selector: %s", selector)
 			if rtrn, ok := ar.affinity[selector]; ok {
-				return rtrn
+				return rtrn, nil
 			} else {
 				// The selector isn't in the map, create a new affinity mapping
 				log.Debugf("MUST CREATE A NEW AFFINITY MAP ENTRY!!")
@@ -295,19 +297,19 @@
 					ar.setAffinity(selector, *ar.currentBackend)
 					//ar.affinity[selector] = *ar.currentBackend
 					//log.Debugf("New affinity set to backend %s",(*ar.currentBackend).name)
-					return *ar.currentBackend
+					return *ar.currentBackend, nil
 				} else {
 					sl.err = err
-					return nil
+					return nil, nil
 				}
 			}
 		}
 	default:
 		log.Errorf("Internal: invalid data type in Route call %v", sel)
-		return nil
+		return nil, nil
 	}
 	log.Errorf("Bad lookup in affinity map %v", ar.affinity)
-	return nil
+	return nil, nil
 }
 
 func (ar AffinityRouter) GetMetaKeyVal(serverStream grpc.ServerStream) (string, string, error) {