patchpanel: move Datapath setup to Datapath
This patch moves all the initial setup for configuring the routing layer
from Manager to Datapath, making it all internal to Datapath. This
allows to refactor Datapath internals without impacting Manager and
allows to hide implementation details from the upper layer.
Incidentally, new unit tests are added for exercising the initial setup
and final tear down of the routing layer.
There is no functional change in this patch.
BUG=b:161507671
TEST=Unit tests.
Change-Id: Ia16648d70f15d741ae95d69becc6e41294e76abc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2397097
Tested-by: Hugo Benichi <hugobenichi@google.com>
Commit-Queue: Hugo Benichi <hugobenichi@google.com>
Reviewed-by: Garrick Evans <garrick@chromium.org>
diff --git a/patchpanel/mock_datapath.h b/patchpanel/mock_datapath.h
index f867bdc..4a76c3d 100644
--- a/patchpanel/mock_datapath.h
+++ b/patchpanel/mock_datapath.h
@@ -22,6 +22,8 @@
: Datapath(runner, firewall) {}
~MockDatapath() = default;
+ MOCK_METHOD0(Start, void());
+ MOCK_METHOD0(Stop, void());
MOCK_METHOD2(NetnsAttachName,
bool(const std::string& netns_name, pid_t netns_pid));
MOCK_METHOD1(NetnsDeleteName, bool(const std::string& netns_name));