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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #include "vom/gbp_bridge_domain_cmds.hpp"
19 namespace gbp_bridge_domain_cmds {
21 create_cmd::create_cmd(HW::item<uint32_t>& item,
23 const handle_t uu_fwd,
24 const gbp_bridge_domain::flags_t& flags)
33 create_cmd::operator==(const create_cmd& other) const
35 return ((m_hw_item.data() == other.m_hw_item.data()) &&
36 (m_bvi == other.m_bvi) && (m_uu_fwd == other.m_uu_fwd) &&
37 (m_flags == other.m_flags));
41 create_cmd::issue(connection& con)
43 msg_t req(con.ctx(), std::ref(*this));
45 auto& payload = req.get_request().get_payload();
47 payload.bd.bd_id = m_hw_item.data();
48 payload.bd.bvi_sw_if_index = m_bvi.value();
49 payload.bd.uu_fwd_sw_if_index = m_uu_fwd.value();
51 payload.bd.flags = GBP_BD_API_FLAG_NONE;
52 if (gbp_bridge_domain::flags_t::DO_NOT_LEARN == m_flags)
53 payload.bd.flags = GBP_BD_API_FLAG_DO_NOT_LEARN;
55 VAPI_CALL(req.execute());
61 create_cmd::to_string() const
64 s << "gbp-bridge-domain: " << m_hw_item.to_string()
65 << " bvi:" << m_bvi.to_string() << " uu-fwd:" << m_uu_fwd.to_string();
70 delete_cmd::delete_cmd(HW::item<uint32_t>& item)
76 delete_cmd::operator==(const delete_cmd& other) const
78 return (m_hw_item.data() == other.m_hw_item.data());
82 delete_cmd::issue(connection& con)
84 msg_t req(con.ctx(), std::ref(*this));
86 auto& payload = req.get_request().get_payload();
88 payload.bd_id = m_hw_item.data();
90 VAPI_CALL(req.execute());
93 m_hw_item.set(rc_t::NOOP);
99 delete_cmd::to_string() const
101 std::ostringstream s;
102 s << "gbp-bridge-domain: " << m_hw_item.to_string();
108 dump_cmd::operator==(const dump_cmd& other) const
114 dump_cmd::issue(connection& con)
116 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
118 VAPI_CALL(m_dump->execute());
126 dump_cmd::to_string() const
128 return ("gbp-bridge-domain-dump");
131 }; // namespace gbp_bridge_domain_cmds
135 * fd.io coding-style-patch-verification: ON
138 * eval: (c-set-style "mozilla")