21 singular_db<const nat_binding::key_t, nat_binding> nat_binding::m_db;
23 nat_binding::event_handler nat_binding::m_evh;
56 : m_binding(o.m_binding)
67 m_db.release(
key(),
this);
73 return (make_tuple(m_itf->key(), m_dir, m_proto));
79 return ((
key() == n.
key()) && (m_zone == n.m_zone));
88 m_binding, m_itf->handle(), m_zone));
91 m_binding, m_itf->handle(), m_zone));
103 m_binding, m_itf->handle(), m_zone));
106 m_binding, m_itf->handle(), m_zone));
120 m_binding, m_itf->handle(), m_zone));
123 m_binding, m_itf->handle(), m_zone));
131 std::ostringstream s;
132 s <<
"nat-binding:[" << m_itf->to_string()
134 <<
" zone:" << m_zone.
to_string() <<
"]";
139 std::shared_ptr<nat_binding>
142 return (m_db.find_or_add(temp.
key(), temp));
145 std::shared_ptr<nat_binding>
148 return (m_db.find(key));
151 std::shared_ptr<nat_binding>
154 return find_or_add(*
this);
166 os <<
"[" << std::get<0>(
key) <<
", " << std::get<1>(key) <<
", " 167 << std::get<2>(
key) <<
"]";
172 nat_binding::event_handler::event_handler()
179 nat_binding::event_handler::handle_replay()
187 std::shared_ptr<nat_binding_cmds::dump_input_44_cmd> icmd =
188 std::make_shared<nat_binding_cmds::dump_input_44_cmd>();
193 for (
auto& record : *icmd) {
194 auto& payload = record.get_payload();
202 std::shared_ptr<nat_binding_cmds::dump_output_44_cmd> ocmd =
203 std::make_shared<nat_binding_cmds::dump_output_44_cmd>();
208 for (
auto& record : *ocmd) {
209 auto& payload = record.get_payload();
219 nat_binding::event_handler::order()
const ~nat_binding()
Destructor.
static const zone_t OUTSIDE
Deny Zone.
A template base class for all enum types.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.
A functor class that binds a NAT configuration to an output interface.
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.
Types belonging to Routing.
A Class representing the binding of an L2 interface to a bridge-domain and the properties of that bin...
static const direction_t INPUT
Permit Direction.
nat_binding(const interface &itf, const direction_t &dir, const l3_proto_t &proto, const zone_t &zone)
Construct a new object matching the desried state.
static const l3_proto_t IPV4
static const zone_t INSIDE
Permit Zone.
bool operator==(const nat_binding &n) const
Comparison operator - for UT.
const key_t key() const
Return the binding's key.
zone_t(int v, const std::string s)
Constructor.
static void dump(std::ostream &os)
Dump all nat_bindings into the stream provided.
A representation of an interface in VPP.
std::string to_string() const
convert to string format for debug purposes
std::shared_ptr< nat_binding > singular() const
Return the 'singular instance' of the L2 config that matches this object.
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 void enqueue(cmd *f)
Enqueue A command for execution.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
Then L2/objects that bind to interfaces, BD, ACLS, etc.
The VPP Object Model (VOM) library.
static std::shared_ptr< nat_binding > find(const key_t &key)
Static function to find the bridge_domain in the model.
static const direction_t OUTPUT
Deny Direction.
const std::string & to_string() const
convert to string format for debug purposes
std::tuple< interface::key_t, direction_t, l3_proto_t > key_t
The key for a NAT Binding.
A cmd class that unbinds a NAT configuration from an output interface.
static const zone_t & from_vpp(u8 is_inside)
static bool register_listener(listener *listener)
Register a listener of events.