21 singular_db<nat_static::key_t, nat_static> nat_static::m_db;
22 nat_static::event_handler nat_static::m_evh;
25 const boost::asio::ip::address_v4& outside)
34 const boost::asio::ip::address& inside,
35 const boost::asio::ip::address_v4& outside)
46 , m_inside(ns.m_inside)
47 , m_outside(ns.m_outside)
56 m_db.release(
key(),
this);
62 return (std::make_pair(m_rd->key(), m_outside));
68 return ((
key() == n.
key()) && (m_inside == n.m_inside));
75 if (m_inside.is_v4()) {
77 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
87 if (m_inside.is_v4()) {
89 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
101 if (m_inside.is_v4()) {
103 m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
111 std::ostringstream s;
113 <<
"table:" << m_rd->to_string() <<
" inside:" << m_inside.to_string()
114 <<
" outside:" << m_outside.to_string() <<
"]";
119 std::shared_ptr<nat_static>
120 nat_static::find_or_add(
const nat_static& temp)
122 return (m_db.find_or_add(temp.
key(), temp));
125 std::shared_ptr<nat_static>
128 return (m_db.find(key));
131 std::shared_ptr<nat_static>
134 return find_or_add(*
this);
143 nat_static::event_handler::event_handler()
150 nat_static::event_handler::handle_replay()
161 std::shared_ptr<nat_static_cmds::dump_44_cmd>
cmd =
162 std::make_shared<nat_static_cmds::dump_44_cmd>();
167 for (
auto& record : *cmd) {
169 auto& payload = record.get_payload();
171 boost::asio::ip::address inside =
from_bytes(0, payload.local_ip_address);
172 boost::asio::ip::address outside =
186 nat_static::event_handler::order()
const A cmd class that deletes a NAT 44 static mapping.
void replay(void)
replay the object to create it in hardware
std::shared_ptr< nat_static > singular() const
Return the matching 'singular instance'.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
A command class that creates NAT 44 static mapping.
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.
std::string to_string() const
Convert to string for debugging.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
rc_t rc() const
Get the HW return code.
A entry in the ARP termination table of a Bridge Domain.
nat_static(const boost::asio::ip::address &inside, const boost::asio::ip::address_v4 &outside)
Construct an NAT Static binding with the outside address in default table.
std::pair< route::table_id_t, boost::asio::ip::address > key_t
The key for a NAT static mapping.
boost::asio::ip::address from_bytes(uint8_t is_ip6, uint8_t *bytes)
Convert a VPP byte stinrg into a boost addresss.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
static const rc_t OK
The HW write was successfull.
static void enqueue(cmd *f)
Enqueue A command for execution.
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
static std::shared_ptr< nat_static > find(const key_t &key)
Find the instnace of the bridge_domain domain in the OM.
bool operator==(const nat_static &n) const
Comparison operator - for UT.
const key_t key() const
Return the object's key.
static bool register_listener(listener *listener)
Register a listener of events.