VOL-4011:Initial commit changes for opendm-agnt
Added test target
building the opendm-agent inside the docker for jenkins

Change-Id: Id27be99dd1770404a94a49b357229a8b97f8a629
diff --git a/src/dmi_common.cc b/src/dmi_common.cc
new file mode 100644
index 0000000..35e32c0
--- /dev/null
+++ b/src/dmi_common.cc
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
diff --git a/src/dmi_events_mgmt.cc b/src/dmi_events_mgmt.cc
new file mode 100644
index 0000000..35e32c0
--- /dev/null
+++ b/src/dmi_events_mgmt.cc
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
diff --git a/src/dmi_hw_mgmt.cc b/src/dmi_hw_mgmt.cc
new file mode 100644
index 0000000..b256862
--- /dev/null
+++ b/src/dmi_hw_mgmt.cc
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
+#include "dmi_hw_mgmt.h"
+
+grpc::Status StartManagingDevice_(
+              const dmi::ModifiableComponent* request,
+              ServerWriter<dmi::StartManagingDeviceResponse>* write)
+{
+    return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented");
+}
+
+grpc::Status StopManagingDevice_(dmi::StopManagingDeviceResponse* response)
+{
+    return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented");
+}
+
+grpc::Status GetManagedDevices_(dmi::ManagedDevicesResponse* response)
+{
+    return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented");
+}
+
+grpc::Status GetPhysicalInventory_(dmi::PhysicalInventoryResponse* response)
+{
+    return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented");
+}
+
+
diff --git a/src/dmi_metrics_mgmt.cc b/src/dmi_metrics_mgmt.cc
new file mode 100644
index 0000000..35e32c0
--- /dev/null
+++ b/src/dmi_metrics_mgmt.cc
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
diff --git a/src/dmi_phycomp_factory.cc b/src/dmi_phycomp_factory.cc
new file mode 100644
index 0000000..ee44286
--- /dev/null
+++ b/src/dmi_phycomp_factory.cc
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
+#ifndef DMI_PHYCOMP_FACTORY_H_
+#include "dmi_phycomp_factory.h"
+#endif
+
+
+
+uint8_t FanComp::UpdateComp(uint8_t comp_number)
+{
+    return 0;
+}
+
+uint8_t FanComp::SetModifiableCompFields(dmi::ModifiableComponent mod_fields)
+{
+	/*Set the Component feilds sent from the NEM/DM in mod_fields */
+    return 0;
+}
+
+uint8_t DiskComp::UpdateComp(uint8_t comp_number)
+{
+	/*Fetch the particular fan details from the onlp array and update the object*/
+    /*Update ComponentSensorData*/
+	return 0;
+}
+
+uint8_t DiskComp::SetModifiableCompFields(dmi::ModifiableComponent mod_fields)
+{
+	/*Set the Component feilds sent from the NEM/DM in mod_fields */
+    return 0;
+}
+
+uint8_t ContainerComp::UpdateComp(uint8_t comp_number)
+{
+	/*Fetch the particular fan details from the onlp array and update the object*/
+    /*Update ComponentSensorData*/
+	return 0;
+}
+
+uint8_t ContainerComp::SetModifiableCompFields(dmi::ModifiableComponent mod_fields)
+{
+	/*Set the Component feilds sent from the NEM/DM in mod_fields */
+    return 0;
+}
+
+uint8_t PortComp::UpdateComp(uint8_t comp_number)
+{
+	/*Fetch the particular fan details from the onlp array and update the object*/
+    /*Update ComponentSensorData*/
+	return 0;
+}
+
+uint8_t PortComp::SetModifiableCompFields(dmi::ModifiableComponent mod_fields)
+{
+	/*Set the Component feilds sent from the NEM/DM in mod_fields */
+    return 0;
+}
+
+uint8_t CPUComp::UpdateComp(uint8_t comp_number)
+{
+	/*Fetch the particular fan details from the onlp array and update the object*/
+    /*Update ComponentSensorData*/
+	return 0;
+}
+
+uint8_t CPUComp::SetModifiableCompFields(dmi::ModifiableComponent mod_fields)
+{
+	/*Set the Component feilds sent from the NEM/DM in mod_fields */
+    return 0;
+}
+
+uint8_t TransceiverComp::UpdateComp(uint8_t comp_number)
+{
+	/*Fetch the particular fan details from the onlp array and update the object*/
+    /*Update ComponentSensorData*/
+	return 0;
+}
+
+uint8_t TransceiverComp::SetModifiableCompFields(dmi::ModifiableComponent mod_fields)
+{
+	/*Set the Component feilds sent from the NEM/DM in mod_fields */
+    return 0;
+}
+
diff --git a/src/dmi_server.cc b/src/dmi_server.cc
new file mode 100644
index 0000000..c5ec9f6
--- /dev/null
+++ b/src/dmi_server.cc
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
+#ifndef DMI_HW_MGMT_H_
+#include "dmi_hw_mgmt.h"
+#endif
+
+#include "dmi_sw_mgmt.h"
+#include "dmi_events_mgmt.h"
+#include "dmi_metrics_mgmt.h"
+
+#define GRPC_ADDRESS "0.0.0.0:9292"
+
+using namespace std;
+
+void RunGrpcServer() {
+    const char* address = GRPC_ADDRESS;
+    HWMgmtService        &HWMgmtSrv     = HWMgmtService::getHWInstance();
+    SWMgmtService        &SWMgmtSrv     = SWMgmtService::getSWInstance();
+    HWEventsMgmtService  &EventMgmtSrv  = HWEventsMgmtService::getHwEventMgmtInstance();
+    HWMetricsMgmtService &MetricMgmtSrv = HWMetricsMgmtService::getHwMetricMgmtInstance();
+
+    ServerBuilder builder;
+
+    builder.AddListeningPort(address, grpc::InsecureServerCredentials());
+    builder.RegisterService(&HWMgmtSrv);
+    builder.RegisterService(&SWMgmtSrv);
+    builder.RegisterService(&EventMgmtSrv);
+    builder.RegisterService(&MetricMgmtSrv);
+
+    std::unique_ptr<Server> server(builder.BuildAndStart());
+    std::cout << "opendm-agent GRPC server listening on port: " << address << std::endl;
+
+    server->Wait();
+}
diff --git a/src/dmi_sw_mgmt.cc b/src/dmi_sw_mgmt.cc
new file mode 100644
index 0000000..ef60bd8
--- /dev/null
+++ b/src/dmi_sw_mgmt.cc
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
+#include "dmi_sw_mgmt.h"
+
+grpc::Status GetSoftwareVersion_(const dmi::HardwareID* request,
+                                dmi::GetSoftwareVersionInformationResponse* response)
+{
+    return Status(grpc::StatusCode::UNIMPLEMENTED, "RPC not implemented");
+}
diff --git a/src/dmi_utils.cc b/src/dmi_utils.cc
new file mode 100644
index 0000000..35e32c0
--- /dev/null
+++ b/src/dmi_utils.cc
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
diff --git a/src/main.cc b/src/main.cc
new file mode 100644
index 0000000..7ba9ec2
--- /dev/null
+++ b/src/main.cc
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ */
+
+#include <iostream>
+#include <unistd.h>
+#include "dmi_server.h"
+
+int main(int argc, char** argv) {
+    RunGrpcServer();
+    return 0;
+}