Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
TestRdkPlugin.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2020 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: TestRdkPlugin.h
21 *
22 */
23#ifndef TESTRDKPLUGIN_H
24#define TESTRDKPLUGIN_H
25
26#include <RdkPluginBase.h>
27
28#include <sys/types.h>
29#include <netinet/in.h>
30
31#include <unistd.h>
32#include <string>
33#include <memory>
34
44{
45public:
46 TestRdkPlugin(std::shared_ptr<rt_dobby_schema>& containerConfig,
47 const std::shared_ptr<DobbyRdkPluginUtils> &utils,
48 const std::string &rootfsPath);
49
50public:
51 inline std::string name() const override
52 {
53 return mName;
54 };
55
56 // Override to return the appropriate hints for what we implement
57 unsigned hookHints() const override;
58
59 // This test hook implements everything
60public:
61 bool postInstallation() override;
62
63 bool preCreation() override;
64
65 bool createRuntime() override;
66
67 bool createContainer() override;
68
69#ifdef USE_STARTCONTAINER_HOOK
70 bool startContainer() override;
71#endif
72
73 bool postStart() override;
74
75 bool postHalt() override;
76
77 bool postStop() override;
78
79public:
80 std::vector<std::string> getDependencies() const override;
81
82private:
83 const std::string mName;
84 std::shared_ptr<rt_dobby_schema> mContainerConfig;
85 const std::string mRootfsPath;
86 const std::shared_ptr<DobbyRdkPluginUtils> mUtils;
87};
88
89#endif // !defined(TESTRDKPLUGIN_H)
Basic object that provides the default overrides for a plugin.
Definition RdkPluginBase.h:34
Simple Dobby RDK Plugin.
Definition TestRdkPlugin.h:44
bool preCreation() override
Dobby Hook - run in host namespace before container creation process.
Definition TestRdkPlugin.cpp:91
bool postInstallation() override
Dobby Hook - run in host namespace once when container bundle is downloaded.
Definition TestRdkPlugin.cpp:74
bool postStart() override
OCI Hook - Run in host namespace once container has started.
Definition TestRdkPlugin.cpp:161
unsigned hookHints() const override
Set the bit flags for which hooks we're going to use.
Definition TestRdkPlugin.cpp:54
bool postStop() override
OCI Hook - Run in host namespace. Confusing name - is run when a container is DELETED.
Definition TestRdkPlugin.cpp:195
bool postHalt() override
Dobby Hook - Run in host namespace when container terminates.
Definition TestRdkPlugin.cpp:178
std::string name() const override
Should return the name of the plugin.
Definition TestRdkPlugin.h:51
std::vector< std::string > getDependencies() const override
Should return the names of the plugins this plugin depends on.
Definition TestRdkPlugin.cpp:219
bool createContainer() override
OCI Hook - Run in container namespace. Paths resolve to host namespace.
Definition TestRdkPlugin.cpp:125
bool createRuntime() override
OCI Hook - Run in host namespace.
Definition TestRdkPlugin.cpp:108