fib: fib api updates
[vpp.git] / extras / vom / vom / mroute_cmds.hpp
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_MROUTE_CMDS_H__
17 #define __VOM_MROUTE_CMDS_H__
18
19 #include "vom/dump_cmd.hpp"
20 #include "vom/route.hpp"
21 #include "vom/rpc_cmd.hpp"
22
23 #include <vapi/ip.api.vapi.hpp>
24
25 namespace VOM {
26 namespace route {
27 namespace ip_mroute_cmds {
28
29 /**
30  * A command class that creates or updates the route
31  */
32 class update_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_mroute_add_del>
33 {
34 public:
35   /**
36    * Constructor
37    */
38   update_cmd(HW::item<bool>& item,
39              table_id_t id,
40              const mprefix_t& mprefix,
41              const path& path,
42              const itf_flags_t& flags);
43
44   /**
45    * Issue the command to VPP/HW
46    */
47   rc_t issue(connection& con);
48
49   /**
50    * convert to string format for debug purposes
51    */
52   std::string to_string() const;
53
54   /**
55    * Comparison operator - only used for UT
56    */
57   bool operator==(const update_cmd& i) const;
58
59 private:
60   route::table_id_t m_id;
61   mprefix_t m_mprefix;
62   const path m_path;
63   const itf_flags_t& m_flags;
64 };
65
66 /**
67  * A cmd class that deletes a route
68  */
69 class delete_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_mroute_add_del>
70 {
71 public:
72   /**
73    * Constructor
74    */
75   delete_cmd(HW::item<bool>& item,
76              table_id_t id,
77              const mprefix_t& mprefix,
78              const path& path,
79              const itf_flags_t& flags);
80
81   /**
82    * Issue the command to VPP/HW
83    */
84   rc_t issue(connection& con);
85
86   /**
87    * convert to string format for debug purposes
88    */
89   std::string to_string() const;
90
91   /**
92    * Comparison operator - only used for UT
93    */
94   bool operator==(const delete_cmd& i) const;
95
96 private:
97   route::table_id_t m_id;
98   mprefix_t m_mprefix;
99   const path m_path;
100   const itf_flags_t& m_flags;
101 };
102
103 /**
104  * A cmd class that Dumps ipv4 fib
105  */
106 class dump_cmd : public VOM::dump_cmd<vapi::Ip_mroute_dump>
107 {
108 public:
109   /**
110    * Constructor
111    */
112   dump_cmd(route::table_id_t id, const l3_proto_t& proto);
113
114   /**
115    * Issue the command to VPP/HW
116    */
117   rc_t issue(connection& con);
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   route::table_id_t m_id;
134   const l3_proto_t& m_proto;
135 };
136
137 }; // namespace ip_mroute_cmds
138 }; // namespace route
139 }; // namespace VOM
140
141 /*
142  * fd.io coding-style-patch-verification: ON
143  *
144  * Local Variables:
145  * eval: (c-set-style "mozilla")
146  * End:
147  */
148
149 #endif