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/inc/dmi_phycomp_factory.h b/inc/dmi_phycomp_factory.h
new file mode 100644
index 0000000..e3711eb
--- /dev/null
+++ b/inc/dmi_phycomp_factory.h
@@ -0,0 +1,224 @@
+/*
+ * 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_
+#define DMI_PHYCOMP_FACTORY_H_
+
+#include "hw_management_service.grpc.pb.h"
+#include "hw_management_service.pb.h"
+#include <iostream>
+#include <string>
+/*
+ * PhyComponent
+ * PhyComponent implement the same interface so that the classes can refer
+ * to the interface not the concrete Component
+ */
+class PhyComponent
+{
+    public:
+        dmi::Component comp;
+        uint8_t comp_number;
+
+        /*Interfaces where each subclasses implements thier specific details*/
+        virtual uint8_t UpdateComp(uint8_t comp_number) = 0;
+        virtual uint8_t SetModifiableCompFields(dmi::ModifiableComponent mod_fields) = 0;
+
+        virtual ~PhyComponent() {}
+};
+
+
+/*
+ * Concrete Component
+ * define Component to be created
+ */
+class FanComp : public PhyComponent
+{
+	public:
+  	FanComp()
+  	{
+        /*Fill the default/common parameters here*/
+		this->comp.set_class_( dmi::ComponentType::COMPONENT_TYPE_FAN);
+		this->comp.set_is_fru( 1 );
+  	}
+
+	uint8_t UpdateComp(uint8_t comp_number);
+	uint8_t SetModifiableCompFields(dmi::ModifiableComponent mod_fields);
+	~FanComp() {}
+};
+
+
+
+/*
+ * Concrete Component
+ * define Component to be created
+ */
+class DiskComp : public PhyComponent
+{
+    public:
+        DiskComp()
+        {
+            this->comp.set_class_( dmi::ComponentType::COMPONENT_TYPE_STORAGE);
+            this->comp.set_is_fru( 0 );
+        }
+
+        uint8_t UpdateComp(uint8_t comp_number);
+        uint8_t SetModifiableCompFields(dmi::ModifiableComponent mod_fields);
+        ~DiskComp() {}
+};
+
+
+/*
+ * Concrete Component
+ * define Component to be created
+ */
+class ContainerComp : public PhyComponent
+{
+    public:
+        ContainerComp()
+        {
+            this->comp.set_class_( dmi::ComponentType::COMPONENT_TYPE_CONTAINER);
+            this->comp.set_is_fru( 0 );
+            //set the container attribute
+        }
+
+        uint8_t UpdateComp(uint8_t comp_number);
+        uint8_t SetModifiableCompFields(dmi::ModifiableComponent mod_fields);
+        ~ContainerComp() {}
+};
+
+
+
+/*
+ * Concrete Component
+ * define Component to be created
+ */
+class PortComp : public PhyComponent
+{
+    public:
+        PortComp()
+        {
+            this->comp.set_class_( dmi::ComponentType::COMPONENT_TYPE_PORT );
+            this->comp.set_is_fru( 0 );
+        }
+
+        uint8_t UpdateComp(uint8_t comp_number);
+        uint8_t SetModifiableCompFields(dmi::ModifiableComponent mod_fields);
+        ~PortComp() {}
+};
+
+
+/*
+ * Concrete Component
+ * define Component to be created
+ */
+class CPUComp : public PhyComponent
+{
+    public:
+        CPUComp()
+        {
+            this->comp.set_class_( dmi::ComponentType::COMPONENT_TYPE_CPU );
+            this->comp.set_is_fru( 0 );
+        }
+
+        uint8_t UpdateComp(uint8_t comp_number);
+        uint8_t SetModifiableCompFields(dmi::ModifiableComponent mod_fields);
+        ~CPUComp() {}
+};
+
+/*
+ * Concrete Component
+ * define Component to be created
+ */
+class TransceiverComp : public PhyComponent
+{
+    public:
+        TransceiverComp()
+        {
+            this->comp.set_class_( dmi::ComponentType::COMPONENT_TYPE_TRANSCEIVER );
+            this->comp.set_is_fru ( 1 );
+        }
+
+        uint8_t UpdateComp(uint8_t comp_number);
+        uint8_t SetModifiableCompFields(dmi::ModifiableComponent mod_fields);
+        ~TransceiverComp() {}
+};
+
+
+/*
+ * Creator
+ * contains the implementation for all of the methods
+ * to manipulate products except for the factory method
+ */
+class Creator
+{
+    public:
+
+        virtual PhyComponent* CreateFanCompInst()         = 0;
+        virtual PhyComponent* CreateDiskCompInst()        = 0;
+        virtual PhyComponent* CreateContainerCompInst()   = 0;
+        virtual PhyComponent* CreatePortCompInst()        = 0;
+        virtual PhyComponent* CreateCPUCompInst()         = 0;
+        virtual PhyComponent* CreateTransceiverCompInst() = 0;
+        virtual void removeComponent( PhyComponent *comp ) = 0;
+        virtual ~Creator() {}
+};
+
+/*
+ * Concrete Creator
+ * implements factory method that is responsible for creating
+ * one or more concrete products ie. it is class that has
+ * the knowledge of how to create the products
+ */
+class ConcreteComp : public Creator
+{
+    public:
+        ~ConcreteComp() {}
+
+        PhyComponent* CreateFanCompInst()
+        {
+            return new FanComp();
+        }
+
+        PhyComponent* CreateDiskCompInst()
+        {
+            return new DiskComp();
+        }
+
+        PhyComponent* CreateContainerCompInst()
+        {
+            return new ContainerComp();
+        }
+
+        PhyComponent* CreatePortCompInst()
+        {
+            return new PortComp();
+        }
+
+        PhyComponent* CreateCPUCompInst()
+        {
+            return new CPUComp();
+        }
+
+        PhyComponent* CreateTransceiverCompInst()
+        {
+            return new TransceiverComp();
+        }
+
+        void removeComponent( PhyComponent *comp )
+        {
+            delete comp;
+        }
+};
+#endif
+