Init commit for standalone enodebd

Change-Id: I88eeef5135dd7ba8551ddd9fb6a0695f5325337b
diff --git a/eventd/eventd_client.py b/eventd/eventd_client.py
new file mode 100644
index 0000000..3f8b63e
--- /dev/null
+++ b/eventd/eventd_client.py
@@ -0,0 +1,52 @@
+"""
+Copyright 2020 The Magma Authors.
+
+This source code is licensed under the BSD-style license found in the
+LICENSE file in the root directory of this source tree.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+import logging
+
+import grpc
+from google.protobuf.json_format import MessageToDict
+from common.service_registry import ServiceRegistry
+from orc8r.protos.eventd_pb2 import Event
+from orc8r.protos.eventd_pb2_grpc import EventServiceStub
+
+EVENTD_SERVICE_NAME = "eventd"
+DEFAULT_GRPC_TIMEOUT = 10
+
+
+def log_event(event: Event) -> None:
+    """
+    Make RPC call to 'LogEvent' method of local eventD service
+    """
+    try:
+        chan = ServiceRegistry.get_rpc_channel(
+            EVENTD_SERVICE_NAME, ServiceRegistry.LOCAL,
+        )
+    except ValueError:
+        logging.error("Cant get RPC channel to %s", EVENTD_SERVICE_NAME)
+        return
+    client = EventServiceStub(chan)
+    try:
+        # Location will be filled in by directory service
+        client.LogEvent(event, DEFAULT_GRPC_TIMEOUT)
+    except grpc.RpcError as err:
+        if err.code() == grpc.StatusCode.UNAVAILABLE:
+            logging.debug(
+                "LogEvent will not occur unless eventd configuration "
+                "is set up.",
+            )
+        else:
+            logging.error(
+                "LogEvent error for event: %s, [%s] %s",
+                MessageToDict(event),
+                err.code(),
+                err.details(),
+            )