21 namespace nat_static_cmds {
25 const boost::asio::ip::address_v4& inside,
26 const boost::asio::ip::address_v4& outside)
37 return ((m_id == other.m_id) && (m_inside == other.m_inside) &&
38 (m_outside == other.m_outside));
44 msg_t req(con.
ctx(), std::ref(*
this));
46 auto& payload = req.get_request().get_payload();
48 payload.addr_only = 1;
49 payload.local_port = 0;
50 payload.external_port = 0;
51 payload.vrf_id = m_id;
52 payload.external_sw_if_index = ~0;
53 to_bytes(m_inside, payload.local_ip_address);
54 to_bytes(m_outside, payload.external_ip_address);
66 <<
" inside:" << m_inside.to_string()
67 <<
" outside:" << m_outside.to_string();
74 const boost::asio::ip::address_v4& inside,
75 const boost::asio::ip::address_v4& outside)
86 return ((m_id == other.m_id) && (m_inside == other.m_inside) &&
87 (m_outside == other.m_outside));
93 msg_t req(con.
ctx(), std::ref(*
this));
95 auto& payload = req.get_request().get_payload();
97 payload.addr_only = 1;
98 payload.local_port = 0;
99 payload.external_port = 0;
100 payload.vrf_id = m_id;
101 payload.external_sw_if_index = ~0;
102 to_bytes(m_inside, payload.local_ip_address);
103 to_bytes(m_outside, payload.external_ip_address);
116 std::ostringstream s;
118 <<
" inside:" << m_inside.to_string()
119 <<
" outside:" << m_outside.to_string();
133 m_dump.reset(
new msg_t(con.
ctx(), std::ref(*
this)));
145 return (
"nat-44-static-dump");
150 const boost::asio::ip::address_v6& inside,
151 const boost::asio::ip::address_v6& outside)
162 return ((m_id == other.m_id) && (m_inside == other.m_inside) &&
163 (m_outside == other.m_outside));
169 msg_t req(con.
ctx(), std::ref(*
this));
171 auto& payload = req.get_request().get_payload();
173 payload.vrf_id = m_id;
174 to_bytes(m_inside, payload.local_ip_address);
175 to_bytes(m_outside, payload.external_ip_address);
185 std::ostringstream s;
187 <<
" inside:" << m_inside.to_string()
188 <<
" outside:" << m_outside.to_string();
195 const boost::asio::ip::address_v6& inside,
196 const boost::asio::ip::address_v6& outside)
207 return ((m_id == other.m_id) && (m_inside == other.m_inside) &&
208 (m_outside == other.m_outside));
214 msg_t req(con.
ctx(), std::ref(*
this));
216 auto& payload = req.get_request().get_payload();
218 payload.vrf_id = m_id;
219 to_bytes(m_inside, payload.local_ip_address);
220 to_bytes(m_outside, payload.external_ip_address);
233 std::ostringstream s;
235 <<
" inside:" << m_inside.to_string()
236 <<
" outside:" << m_outside.to_string();
250 m_dump.reset(
new msg_t(con.
ctx(), std::ref(*
this)));
262 return (
"nat-static-dump");
std::string to_string() const
convert to string format for debug purposes
A cmd class that deletes a NAT 44 static mapping.
uint32_t table_id_t
type def the table-id
static const rc_t NOOP
The HW write/update action was/has not been attempted.
rc_t issue(connection &con)
Issue the command to VPP/HW.
A command class that creates NAT 44 static mapping.
rc_t issue(connection &con)
Issue the command to VPP/HW.
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
create_44_cmd(HW::item< bool > &item, route::table_id_t id, const boost::asio::ip::address_v4 &inside, const boost::asio::ip::address_v4 &outside)
Constructor.
create_66_cmd(HW::item< bool > &item, route::table_id_t id, const boost::asio::ip::address_v6 &inside, const boost::asio::ip::address_v6 &outside)
Constructor.
Error codes that VPP will return during a HW write.
std::string to_string() const
convert to string format for debug purposes
bool operator==(const dump_44_cmd &i) const
Comparison operator - only used for UT.
std::string to_string() const
convert to string format for debug purposes
rc_t wait()
Wait on the commands promise.
bool operator==(const delete_44_cmd &i) const
Comparison operator - only used for UT.
void to_bytes(const boost::asio::ip::address_v6 &addr, uint8_t *array)
A representation of the connection to VPP.
bool operator==(const delete_66_cmd &i) const
Comparison operator - only used for UT.
std::string to_string() const
convert to string format for debug purposes
bool operator==(const dump_66_cmd &i) const
Comparison operator - only used for UT.
A base class for all RPC commands to VPP.
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
delete_44_cmd(HW::item< bool > &item, route::table_id_t id, const boost::asio::ip::address_v4 &inside, const boost::asio::ip::address_v4 &outside)
Constructor.
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that deletes a NAT 66 static mapping.
rc_t issue(connection &con)
Issue the command to VPP/HW.
A cmd class that Dumps all the nat_statics.
std::string to_string() const
convert to string format for debug purposes
static const rc_t OK
The HW write was successfull.
bool operator==(const create_44_cmd &i) const
Comparison operator - only used for UT.
A cmd class that Dumps all the nat_statics.
vapi::Connection & ctx()
Retrun the VAPI context the commands will use.
The VPP Object Model (VOM) library.
rc_t issue(connection &con)
Issue the command to VPP/HW.
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
DEFINE_VAPI_MSG_IDS_NAT_API_JSON
delete_66_cmd(HW::item< bool > &item, route::table_id_t id, const boost::asio::ip::address_v6 &inside, const boost::asio::ip::address_v6 &outside)
Constructor.
A command class that creates NAT 66 static mapping.
HW::item< bool > & m_hw_item
A reference to an object's HW::item that the command will update.
HW::item< bool > & item()
return the HW item the command updates
bool operator==(const create_66_cmd &i) const
Comparison operator - only used for UT.
vapi::Nat44_add_del_static_mapping msg_t
convenient typedef