24 singular_db<interface::key_t, dhcp_config> dhcp_config::m_db;
26 dhcp_config::event_handler dhcp_config::m_evh;
29 const std::string& hostname,
30 bool set_broadcast_flag)
31 : m_itf(itf.singular())
32 , m_hostname(hostname)
34 , m_set_broadcast_flag(set_broadcast_flag)
40 const std::string& hostname,
42 bool set_broadcast_flag)
44 , m_hostname(hostname)
45 , m_client_id(client_id)
46 , m_set_broadcast_flag(set_broadcast_flag)
53 , m_hostname(o.m_hostname)
54 , m_client_id(o.m_client_id)
55 , m_set_broadcast_flag(o.m_set_broadcast_flag)
65 m_db.release(m_itf->key(),
this);
71 return ((
key() == l.
key()) && (m_hostname == l.m_hostname) &&
72 (m_client_id == l.m_client_id));
78 return (m_itf->key());
102 m_hostname, m_client_id));
109 std::ostringstream s;
110 s <<
"Dhcp-config: " << m_itf->to_string() <<
" hostname:" << m_hostname
111 <<
" client_id:[" << m_client_id <<
"] " << m_binding.
to_string();
124 m_hostname, m_client_id));
128 std::shared_ptr<dhcp_config>
131 return (m_db.find_or_add(temp.m_itf->key(), temp));
134 std::shared_ptr<dhcp_config>
137 return (m_db.find(k));
140 std::shared_ptr<dhcp_config>
143 return find_or_add(*
this);
147 : m_status(
rc_t::NOOP)
157 dhcp_config::event_handler::event_handler()
164 dhcp_config::event_handler::handle_replay()
176 dhcp_config::event_handler::order()
const A command class that binds the DHCP config to the interface.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
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.
dhcp_config(const interface &itf, const std::string &hostname, bool set_broadcast_flag=true)
Construct a new object matching the desried state.
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.