FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
l2_xconnect_cmds.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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_L2_XCONNECT_CMDS_H__
17 #define __VOM_L2_XCONNECT_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/l2_xconnect.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/l2.api.vapi.hpp>
24 #include <vapi/vpe.api.vapi.hpp>
25 
26 namespace VOM {
27 namespace l2_xconnect_cmds {
28 
29 /**
30  * A functor class that binds L2 configuration to an interface
31  */
32 class bind_cmd
33  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_l2_xconnect>
34 {
35 public:
36  /**
37  * Constructor
38  */
40  const handle_t& east_itf,
41  const handle_t& west_itf);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
46  rc_t issue(connection& con);
47  /**
48  * convert to string format for debug purposes
49  */
50  std::string to_string() const;
51 
52  /**
53  * Comparison operator - only used for UT
54  */
55  bool operator==(const bind_cmd& i) const;
56 
57 private:
58  /**
59  * The east interface for cross_connect
60  */
61  const handle_t m_east_itf;
62 
63  /**
64  * The west interface for x-connect
65  */
66  const handle_t m_west_itf;
67 };
68 
69 /**
70  * A cmd class that Unbinds L2 configuration from an interface
71  */
73  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_l2_xconnect>
74 {
75 public:
76  /**
77  * Constructor
78  */
80  const handle_t& east_itf,
81  const handle_t& west_itf);
82 
83  /**
84  * Issue the command to VPP/HW
85  */
86  rc_t issue(connection& con);
87 
88  /**
89  * convert to string format for debug purposes
90  */
91  std::string to_string() const;
92 
93  /**
94  * Comparison operator - only used for UT
95  */
96  bool operator==(const unbind_cmd& i) const;
97 
98 private:
99  /**
100  * The east interface for x-connect
101  */
102  const handle_t m_east_itf;
103 
104  /**
105  * The west interface for x-connect
106  */
107  const handle_t m_west_itf;
108 };
109 
110 /**
111  * A cmd class that Dumps all the bridge domains
112  */
113 class dump_cmd : public VOM::dump_cmd<vapi::L2_xconnect_dump>
114 {
115 public:
116  /**
117  * Constructor
118  */
119  dump_cmd();
120 
121  /**
122  * Issue the command to VPP/HW
123  */
124  rc_t issue(connection& con);
125  /**
126  * convert to string format for debug purposes
127  */
128  std::string to_string() const;
129 
130  /**
131  * Comparison operator - only used for UT
132  */
133  bool operator==(const dump_cmd& i) const;
134 };
135 
136 }; // namespace l2_xconnect_cmds
137 }; // namespace VOM
138 
139 /*
140  * fd.io coding-style-patch-verification: ON
141  *
142  * Local Variables:
143  * eval: (c-set-style "mozilla")
144  * End:
145  */
146 
147 #endif
A functor class that binds L2 configuration to an interface.
A cmd class that Dumps all the bridge domains.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A cmd class that Unbinds L2 configuration from an interface.
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
A representation of the connection to VPP.
Definition: connection.hpp:33
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
bind_cmd(HW::item< bool > &item, const handle_t &east_itf, const handle_t &west_itf)
Constructor.
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66