#ifndef __VOM_ROUTE_DOMAIN_H__
#define __VOM_ROUTE_DOMAIN_H__
+#include "vom/inspect.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
#include "vom/prefix.hpp"
*/
~route_domain();
+ /**
+ * comparison operator - for UT
+ */
+ bool operator==(const route_domain& r) const;
+
/**
* Return the matching 'singular instance'
*/
/**
* Find the instnace of the route domain in the OM
*/
- static std::shared_ptr<route_domain> find(const route_domain& temp);
+ static std::shared_ptr<route_domain> find(const key_t& temp);
/**
* Dump all route-doamin into the stream provided
*/
void replay(void);
+private:
/**
- * A command class that creates the IP table
+ * Class definition for listeners to OM events
*/
- class create_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del>
+ class event_handler : public OM::listener, public inspect::command_handler
{
public:
- /**
- * Constructor
- */
- create_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
+ event_handler();
+ virtual ~event_handler() = default;
/**
- * convert to string format for debug purposes
+ * Handle a populate event
*/
- std::string to_string() const;
+ void handle_populate(const client_db::key_t& key);
/**
- * Comparison operator - only used for UT
+ * Handle a replay event
*/
- bool operator==(const create_cmd& i) const;
+ void handle_replay();
- private:
/**
- * table-ID to create
+ * Show the object in the Singular DB
*/
- route::table_id_t m_id;
+ void show(std::ostream& os);
/**
- * L3 protocol of the table
+ * Get the sortable Id of the listener
*/
- l3_proto_t m_proto;
+ dependency_t order() const;
};
/**
- * A cmd class that Deletes the IP Table
+ * Instance of the event handler to register with OM
*/
- class delete_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
+ static event_handler m_evh;
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
-
- private:
- /**
- * table-ID to create
- */
- route::table_id_t m_id;
-
- /**
- * L3 protocol of the table
- */
- l3_proto_t m_proto;
- };
-
-private:
/**
* Commit the acculmulated changes into VPP. i.e. to a 'HW" write.
*/
*/
static singular_db<route::table_id_t, route_domain> m_db;
};
-};
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON