FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
neighbour_cmds.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __VOM_NEIGHBOUR_CMDS_H__
17 #define __VOM_NEIGHBOUR_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/srpc_cmd.hpp"
21 #include "neighbour.hpp"
22 
23 #include <vapi/ip_neighbor.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace neighbour_cmds {
27 
28 /**
29  * A command class that creates or updates the bridge domain ARP Entry
30  */
31 class create_cmd : public srpc_cmd<vapi::Ip_neighbor_add_del>
32 {
33 public:
34  /**
35  * Constructor
36  */
38  handle_t itf,
39  const mac_address_t& mac,
40  const boost::asio::ip::address& ip_addr,
41  const neighbour::flags_t &flags);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
47 
48  /**
49  * convert to string format for debug purposes
50  */
51  std::string to_string() const;
52 
53  /**
54  * Comparison operator - only used for UT
55  */
56  bool operator==(const create_cmd& i) const;
57 
58 private:
59  handle_t m_itf;
60  mac_address_t m_mac;
61  boost::asio::ip::address m_ip_addr;
62  const neighbour::flags_t &m_flags;
63 };
64 
65 /**
66  * A cmd class that deletes a bridge domain ARP entry
67  */
68 class delete_cmd : public srpc_cmd<vapi::Ip_neighbor_add_del>
69 {
70 public:
71  /**
72  * Constructor
73  */
75  handle_t itf,
76  const mac_address_t& mac,
77  const boost::asio::ip::address& ip_addr,
78  const neighbour::flags_t &flags);
79 
80  /**
81  * Issue the command to VPP/HW
82  */
84 
85  /**
86  * convert to string format for debug purposes
87  */
88  std::string to_string() const;
89 
90  /**
91  * Comparison operator - only used for UT
92  */
93  bool operator==(const delete_cmd& i) const;
94 
95 private:
96  handle_t m_itf;
97  mac_address_t m_mac;
98  boost::asio::ip::address m_ip_addr;
99  const neighbour::flags_t &m_flags;
100 };
101 
102 /**
103  * A cmd class that Dumps all the neighbours
104  */
105 class dump_cmd : public VOM::dump_cmd<vapi::Ip_neighbor_dump>
106 {
107 public:
108  /**
109  * Constructor
110  */
111  dump_cmd(const handle_t& itf, const l3_proto_t& proto);
112  dump_cmd(const dump_cmd& d);
113 
114  /**
115  * Issue the command to VPP/HW
116  */
118  /**
119  * convert to string format for debug purposes
120  */
121  std::string to_string() const;
122 
123  /**
124  * Comparison operator - only used for UT
125  */
126  bool operator==(const dump_cmd& i) const;
127 
128 private:
129  /**
130  * HW reutrn code
131  */
132  HW::item<bool> item;
133 
134  /**
135  * The interface to dump
136  */
137  handle_t m_itf;
138 
139  /**
140  * V4 or V6
141  */
142  l3_proto_t m_proto;
143 };
144 
145 }; // namespace neighbour_cmds
146 }; // namespace vom
147 #endif
148 
VOM::HW::item< handle_t >
neighbour.hpp
mac
vl_api_mac_address_t mac
Definition: l2.api:559
VOM::neighbour_cmds::delete_cmd::delete_cmd
delete_cmd(HW::item< handle_t > &item, handle_t itf, const mac_address_t &mac, const boost::asio::ip::address &ip_addr, const neighbour::flags_t &flags)
Constructor.
Definition: neighbour_cmds.cpp:71
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::neighbour_cmds::delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: neighbour_cmds.cpp:112
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::neighbour_cmds::create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: neighbour_cmds.cpp:61
VOM::neighbour_cmds::create_cmd::create_cmd
create_cmd(HW::item< handle_t > &item, handle_t itf, const mac_address_t &mac, const boost::asio::ip::address &ip_addr, const neighbour::flags_t &flags)
Constructor.
Definition: neighbour_cmds.cpp:23
VOM::neighbour_cmds::delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: neighbour_cmds.cpp:91
VOM::neighbour_cmds::delete_cmd::operator==
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
Definition: neighbour_cmds.cpp:84
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::neighbour_cmds::create_cmd::operator==
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
Definition: neighbour_cmds.cpp:36
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::neighbour_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: neighbour_cmds.cpp:139
address
manual_print typedef address
Definition: ip_types.api:96
VOM::neighbour_cmds::create_cmd
A command class that creates or updates the bridge domain ARP Entry.
Definition: neighbour_cmds.hpp:31
dump_cmd.hpp
VOM::neighbour_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: neighbour_cmds.cpp:155
VOM::neighbour_cmds::create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: neighbour_cmds.cpp:43
VOM::neighbour_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: neighbour_cmds.cpp:133
VOM::neighbour_cmds::dump_cmd
A cmd class that Dumps all the neighbours.
Definition: neighbour_cmds.hpp:105
VOM::rpc_cmd< HW::item< handle_t >, vapi::Ip_neighbor_add_del >::item
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::l3_proto_t
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route.
Definition: prefix.hpp:52
VOM::srpc_cmd
Definition: srpc_cmd.hpp:24
VOM::neighbour_cmds::delete_cmd
A cmd class that deletes a bridge domain ARP entry.
Definition: neighbour_cmds.hpp:68
VOM::mac_address_t
Type def of a Ethernet address.
Definition: types.hpp:295
VOM::dump_cmd< vapi::Ip_neighbor_dump >::dump_cmd
dump_cmd()
Default Constructor.
Definition: dump_cmd.hpp:55
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
VOM::neighbour::flags_t
Definition: neighbour.hpp:30
string
const char *const string
Definition: cJSON.h:172
srpc_cmd.hpp
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105