23 singular_db<interface::key_t, dhcp_config> dhcp_config::m_db;
25 dhcp_config::event_handler dhcp_config::m_evh;
28 : m_itf(itf.singular())
29 , m_hostname(hostname)
36 const std::string& hostname,
39 , m_hostname(hostname)
40 , m_client_id(client_id)
47 , m_hostname(o.m_hostname)
48 , m_client_id(o.m_client_id)
58 m_db.release(m_itf->key(),
this);
64 return ((
key() == l.
key()) && (m_hostname == l.m_hostname) &&
65 (m_client_id == l.m_client_id));
71 return (m_itf->key());
95 m_hostname, m_client_id));
102 std::ostringstream s;
103 s <<
"Dhcp-config: " << m_itf->to_string() <<
" hostname:" << m_hostname
104 <<
" client_id:[" << m_client_id <<
"] " << m_binding.
to_string();
117 m_hostname, m_client_id));
121 std::shared_ptr<dhcp_config>
124 return (m_db.find_or_add(temp.m_itf->key(), temp));
127 std::shared_ptr<dhcp_config>
130 return (m_db.find(k));
133 std::shared_ptr<dhcp_config>
136 return find_or_add(*
this);
140 : m_status(
rc_t::NOOP)
150 dhcp_config::event_handler::event_handler()
157 dhcp_config::event_handler::handle_replay()
169 dhcp_config::event_handler::order()
const A command class that binds the DHCP config to the interface.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
dhcp_config(const interface &itf, const std::string &hostname)
Construct a new object matching the desried state.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
static rc_t write()
Write/Execute all commands hitherto enqueued.
Error codes that VPP will return during a HW write.
event_listener()
Constructor.
std::string to_string() const
convert to string format for debug purposes
Type def of a L2 address as read from VPP.
bool operator==(const dhcp_config &d) const
Comparison operator - for UT.
static std::shared_ptr< dhcp_config > find(const key_t &k)
Find a DHCP config from its key.
A cmd class that Unbinds Dhcp Config from an interface.
A representation of DHCP client configuration on an interface.
HW::item< bool > & status()
Return the HW::item associated with this command.
const key_t & key() const
Return the object's key.
std::shared_ptr< dhcp_config > singular() const
Return the 'singular' of the DHCP config that matches this object.
A representation of an interface in VPP.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
static void enqueue(cmd *f)
Enqueue A command for execution.
Then L2/objects that bind to interfaces, BD, ACLS, etc.
The VPP Object Model (VOM) library.
interface::key_t key_t
typedef for the DHCP config key type
~dhcp_config()
Destructor.
std::string to_string() const
convert to string format for debug purposes
static void dump(std::ostream &os)
Dump all DHCP configs into the stream provided.
static bool register_listener(listener *listener)
Register a listener of events.
HW::item< bool > m_status
The HW::item associated with this command.