FD.io VPP  v21.06-3-gbb25fbf28
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  */
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  */
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  */
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: OFF
141  *
142  * Local Variables:
143  * eval: (c-set-style "mozilla")
144  * End:
145  */
146 
147 #endif
VOM::HW::item< bool >
VOM::l2_xconnect_cmds::dump_cmd::dump_cmd
dump_cmd()
Constructor.
Definition: l2_xconnect_cmds.cpp:107
VOM::l2_xconnect_cmds::bind_cmd
A functor class that binds L2 configuration to an interface.
Definition: l2_xconnect_cmds.hpp:32
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::l2_xconnect_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: l2_xconnect_cmds.cpp:112
VOM::l2_xconnect_cmds::unbind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: l2_xconnect_cmds.cpp:97
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::l2_xconnect_cmds::bind_cmd::operator==
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
Definition: l2_xconnect_cmds.cpp:30
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::l2_xconnect_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: l2_xconnect_cmds.cpp:118
VOM::l2_xconnect_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: l2_xconnect_cmds.cpp:130
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::l2_xconnect_cmds::unbind_cmd::operator==
bool operator==(const unbind_cmd &i) const
Comparison operator - only used for UT.
Definition: l2_xconnect_cmds.cpp:73
VOM::l2_xconnect_cmds::dump_cmd
A cmd class that Dumps all the bridge domains.
Definition: l2_xconnect_cmds.hpp:113
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
l2_xconnect.hpp
dump_cmd.hpp
VOM::rpc_cmd< HW::item< bool >, vapi::Sw_interface_set_l2_xconnect >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::l2_xconnect_cmds::bind_cmd::bind_cmd
bind_cmd(HW::item< bool > &item, const handle_t &east_itf, const handle_t &west_itf)
Constructor.
Definition: l2_xconnect_cmds.cpp:20
VOM::l2_xconnect_cmds::unbind_cmd::unbind_cmd
unbind_cmd(HW::item< bool > &item, const handle_t &east_itf, const handle_t &west_itf)
Constructor.
Definition: l2_xconnect_cmds.cpp:63
VOM::l2_xconnect_cmds::bind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: l2_xconnect_cmds.cpp:36
VOM::l2_xconnect_cmds::bind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: l2_xconnect_cmds.cpp:53
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
VOM::l2_xconnect_cmds::unbind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: l2_xconnect_cmds.cpp:79
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172
VOM::l2_xconnect_cmds::unbind_cmd
A cmd class that Unbinds L2 configuration from an interface.
Definition: l2_xconnect_cmds.hpp:72