blob: f323727b052d8a25bdb76ef242f9a122d040fb06 [file] [log] [blame]
Neale Ranns812ed392017-10-16 04:20:13 -07001/*
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#include "vom/interface.hpp"
Mohsin Kazmied76ee22018-03-02 12:31:37 +010017#include "vom/bond_group_binding.hpp"
18#include "vom/bond_group_binding_cmds.hpp"
19#include "vom/bond_interface_cmds.hpp"
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070020#include "vom/interface_cmds.hpp"
21#include "vom/interface_factory.hpp"
22#include "vom/l3_binding_cmds.hpp"
Neale Ranns812ed392017-10-16 04:20:13 -070023#include "vom/logger.hpp"
24#include "vom/prefix.hpp"
25
26namespace VOM {
27/**
28 * A DB of all the interfaces, key on the name
29 */
Neale Rannsfd920602017-11-23 12:15:00 -080030singular_db<interface::key_t, interface> interface::m_db;
Neale Ranns812ed392017-10-16 04:20:13 -070031
32/**
33 * A DB of all the interfaces, key on VPP's handle
34 */
35std::map<handle_t, std::weak_ptr<interface>> interface::m_hdl_db;
36
37interface::event_handler interface::m_evh;
38
39/**
40 * Construct a new object matching the desried state
41 */
42interface::interface(const std::string& name,
43 interface::type_t itf_type,
Neale Ranns4ef42262018-02-20 08:10:44 -080044 interface::admin_state_t itf_state,
45 const std::string& tag)
Neale Ranns812ed392017-10-16 04:20:13 -070046 : m_hdl(handle_t::INVALID)
47 , m_name(name)
48 , m_type(itf_type)
49 , m_state(itf_state)
50 , m_table_id(route::DEFAULT_TABLE)
51 , m_l2_address(l2_address_t::ZERO, rc_t::UNSET)
52 , m_oper(oper_state_t::DOWN)
Neale Ranns4ef42262018-02-20 08:10:44 -080053 , m_tag(tag)
Neale Ranns812ed392017-10-16 04:20:13 -070054{
55}
56
Neale Ranns812ed392017-10-16 04:20:13 -070057interface::interface(const std::string& name,
58 interface::type_t itf_type,
59 interface::admin_state_t itf_state,
Neale Ranns4ef42262018-02-20 08:10:44 -080060 const route_domain& rd,
61 const std::string& tag)
Neale Ranns812ed392017-10-16 04:20:13 -070062 : m_hdl(handle_t::INVALID)
63 , m_name(name)
64 , m_type(itf_type)
65 , m_rd(rd.singular())
66 , m_state(itf_state)
67 , m_table_id(m_rd->table_id())
68 , m_l2_address(l2_address_t::ZERO, rc_t::UNSET)
69 , m_oper(oper_state_t::DOWN)
Neale Ranns4ef42262018-02-20 08:10:44 -080070 , m_tag(tag)
Neale Ranns812ed392017-10-16 04:20:13 -070071{
72}
73
74interface::interface(const interface& o)
75 : m_hdl(o.m_hdl)
76 , m_name(o.m_name)
77 , m_type(o.m_type)
78 , m_rd(o.m_rd)
79 , m_state(o.m_state)
80 , m_table_id(o.m_table_id)
81 , m_l2_address(o.m_l2_address)
82 , m_oper(o.m_oper)
Neale Ranns4ef42262018-02-20 08:10:44 -080083 , m_tag(o.m_tag)
Neale Ranns812ed392017-10-16 04:20:13 -070084{
85}
86
Neale Rannsfd920602017-11-23 12:15:00 -080087bool
88interface::operator==(const interface& i) const
89{
90 return ((key() == i.key()) &&
91 (m_l2_address.data() == i.m_l2_address.data()) &&
92 (m_state == i.m_state) && (m_rd == i.m_rd) && (m_type == i.m_type) &&
93 (m_oper == i.m_oper));
94}
95
Neale Ranns812ed392017-10-16 04:20:13 -070096interface::event_listener::event_listener()
97 : m_status(rc_t::NOOP)
98{
99}
100
101HW::item<bool>&
102interface::event_listener::status()
103{
104 return (m_status);
105}
106
107interface::stat_listener::stat_listener()
108 : m_status(rc_t::NOOP)
109{
110}
111
112HW::item<bool>&
113interface::stat_listener::status()
114{
115 return (m_status);
116}
117
118/**
119 * Return the interface type
120 */
121const interface::type_t&
122interface::type() const
123{
124 return (m_type);
125}
126
127const handle_t&
128interface::handle() const
129{
Neale Ranns263f9552017-11-15 02:52:13 -0800130 return (singular()->handle_i());
131}
132
133const handle_t&
134interface::handle_i() const
135{
Neale Ranns812ed392017-10-16 04:20:13 -0700136 return (m_hdl.data());
137}
138
139const l2_address_t&
140interface::l2_address() const
141{
142 return (m_l2_address.data());
143}
144
145interface::const_iterator_t
146interface::cbegin()
147{
148 return m_db.cbegin();
149}
150
151interface::const_iterator_t
152interface::cend()
153{
154 return m_db.cend();
155}
156
157void
158interface::sweep()
159{
Neale Ranns352ea0c2017-11-14 11:04:28 -0800160 if (m_table_id && (m_table_id.data() != route::DEFAULT_TABLE)) {
Neale Ranns812ed392017-10-16 04:20:13 -0700161 m_table_id.data() = route::DEFAULT_TABLE;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700162 HW::enqueue(
163 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
164 HW::enqueue(
165 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700166 }
167
Neale Rannsa2ee0292017-11-28 22:29:13 -0800168 if (m_stats) {
169 HW::enqueue(new interface_cmds::stats_disable_cmd(m_hdl.data()));
170 m_stats.reset();
171 }
Mohsin Kazmi5a4f96a2017-11-20 10:23:47 +0100172
Neale Ranns812ed392017-10-16 04:20:13 -0700173 // If the interface is up, bring it down
174 if (m_state && interface::admin_state_t::UP == m_state.data()) {
175 m_state.data() = interface::admin_state_t::DOWN;
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700176 HW::enqueue(new interface_cmds::state_change_cmd(m_state, m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700177 }
Mohsin Kazmi5a4f96a2017-11-20 10:23:47 +0100178
Neale Ranns812ed392017-10-16 04:20:13 -0700179 if (m_hdl) {
180 std::queue<cmd*> cmds;
181 HW::enqueue(mk_delete_cmd(cmds));
182 }
183 HW::write();
184}
185
186void
187interface::replay()
188{
189 if (m_hdl) {
190 std::queue<cmd*> cmds;
191 HW::enqueue(mk_create_cmd(cmds));
192 }
193
194 if (m_state && interface::admin_state_t::UP == m_state.data()) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700195 HW::enqueue(new interface_cmds::state_change_cmd(m_state, m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700196 }
197
Neale Ranns352ea0c2017-11-14 11:04:28 -0800198 if (m_table_id && (m_table_id.data() != route::DEFAULT_TABLE)) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700199 HW::enqueue(
200 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
201 HW::enqueue(
202 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700203 }
204}
205
206interface::~interface()
207{
208 sweep();
209 release();
210}
211
212void
213interface::release()
214{
215 // not in the DB anymore.
216 m_db.release(m_name, this);
217}
218
219std::string
220interface::to_string() const
221{
222 std::ostringstream s;
223 s << "interface:[" << m_name << " type:" << m_type.to_string()
Neale Rannsfd920602017-11-23 12:15:00 -0800224 << " hdl:" << m_hdl.to_string() << " l2-address:["
225 << m_l2_address.to_string() << "]";
Neale Ranns812ed392017-10-16 04:20:13 -0700226
227 if (m_rd) {
228 s << " rd:" << m_rd->to_string();
229 }
230
231 s << " admin-state:" << m_state.to_string()
Neale Ranns4ef42262018-02-20 08:10:44 -0800232 << " oper-state:" << m_oper.to_string();
233
234 if (!m_tag.empty()) {
235 s << " tag:[" << m_tag << "]";
236 }
237
238 s << "]";
Neale Ranns812ed392017-10-16 04:20:13 -0700239
240 return (s.str());
241}
242
243const std::string&
244interface::name() const
245{
246 return (m_name);
247}
248
Neale Rannsfd920602017-11-23 12:15:00 -0800249const interface::key_t&
Neale Ranns812ed392017-10-16 04:20:13 -0700250interface::key() const
251{
252 return (name());
253}
254
255std::queue<cmd*>&
256interface::mk_create_cmd(std::queue<cmd*>& q)
257{
258 if (type_t::LOOPBACK == m_type) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700259 q.push(new interface_cmds::loopback_create_cmd(m_hdl, m_name));
Neale Ranns812ed392017-10-16 04:20:13 -0700260 } else if (type_t::BVI == m_type) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700261 q.push(new interface_cmds::loopback_create_cmd(m_hdl, m_name));
262 q.push(new interface_cmds::set_tag(m_hdl, m_name));
Neale Ranns4ef42262018-02-20 08:10:44 -0800263 /*
264 * set the m_tag for pretty-print
265 */
266 m_tag = m_name;
Neale Ranns812ed392017-10-16 04:20:13 -0700267 } else if (type_t::AFPACKET == m_type) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700268 q.push(new interface_cmds::af_packet_create_cmd(m_hdl, m_name));
Neale Ranns4ef42262018-02-20 08:10:44 -0800269 if (!m_tag.empty())
270 q.push(new interface_cmds::set_tag(m_hdl, m_tag));
Neale Ranns812ed392017-10-16 04:20:13 -0700271 } else if (type_t::TAP == m_type) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700272 q.push(new interface_cmds::tap_create_cmd(m_hdl, m_name));
Neale Ranns4ef42262018-02-20 08:10:44 -0800273 if (!m_tag.empty())
274 q.push(new interface_cmds::set_tag(m_hdl, m_tag));
275 } else if (type_t::VHOST == m_type) {
276 q.push(new interface_cmds::vhost_create_cmd(m_hdl, m_name, m_tag));
Neale Ranns088f0e22017-12-01 00:19:43 -0800277 } else {
278 m_hdl.set(rc_t::OK);
Neale Ranns812ed392017-10-16 04:20:13 -0700279 }
280
281 return (q);
282}
283
284std::queue<cmd*>&
285interface::mk_delete_cmd(std::queue<cmd*>& q)
286{
287 if ((type_t::LOOPBACK == m_type) || (type_t::BVI == m_type)) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700288 q.push(new interface_cmds::loopback_delete_cmd(m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700289 } else if (type_t::AFPACKET == m_type) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700290 q.push(new interface_cmds::af_packet_delete_cmd(m_hdl, m_name));
Neale Ranns812ed392017-10-16 04:20:13 -0700291 } else if (type_t::TAP == m_type) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700292 q.push(new interface_cmds::tap_delete_cmd(m_hdl));
Neale Ranns4ef42262018-02-20 08:10:44 -0800293 } else if (type_t::VHOST == m_type) {
294 q.push(new interface_cmds::vhost_delete_cmd(m_hdl, m_name));
Neale Ranns812ed392017-10-16 04:20:13 -0700295 }
296
297 return (q);
298}
299
300void
301interface::update(const interface& desired)
302{
303 /*
Neale Ranns352ea0c2017-11-14 11:04:28 -0800304 * the desired state is always that the interface should be created
305 */
Neale Ranns812ed392017-10-16 04:20:13 -0700306 if (rc_t::OK != m_hdl.rc()) {
307 std::queue<cmd*> cmds;
308 HW::enqueue(mk_create_cmd(cmds));
Neale Ranns8ac4ce82017-11-17 05:08:55 -0800309 /*
310 * interface create now, so we can barf early if it fails
311 */
312 HW::write();
Neale Ranns812ed392017-10-16 04:20:13 -0700313 }
314
315 /*
Neale Ranns8ac4ce82017-11-17 05:08:55 -0800316 * If the interface is not created do other commands should be issued
317 */
318 if (rc_t::OK != m_hdl.rc())
319 return;
320
321 /*
Neale Ranns352ea0c2017-11-14 11:04:28 -0800322 * change the interface state to that which is deisred
323 */
Neale Ranns812ed392017-10-16 04:20:13 -0700324 if (m_state.update(desired.m_state)) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700325 HW::enqueue(new interface_cmds::state_change_cmd(m_state, m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700326 }
327
328 /*
Neale Ranns352ea0c2017-11-14 11:04:28 -0800329 * change the interface state to that which is deisred
330 */
Neale Ranns812ed392017-10-16 04:20:13 -0700331 if (m_l2_address.update(desired.m_l2_address)) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700332 HW::enqueue(new interface_cmds::set_mac_cmd(m_l2_address, m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700333 }
334
335 /*
Neale Ranns352ea0c2017-11-14 11:04:28 -0800336 * If the interface is mapped into a route domain, set VPP's
337 * table ID
338 */
339 if (m_rd != desired.m_rd) {
340 /*
341 * changing route domains. need to remove all L3 bindings, swap the table
342 * then reapply the bindings.
343 */
344 auto it = l3_binding::cbegin();
345
346 while (it != l3_binding::cend()) {
347 if (it->second.lock()->itf().key() == key())
348 it->second.lock()->sweep();
349 ++it;
350 }
351 m_rd = desired.m_rd;
352 m_table_id.update(m_rd ? m_rd->table_id() : route::DEFAULT_TABLE);
353 HW::enqueue(
354 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
355 HW::enqueue(
356 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
357 HW::write();
358
359 it = l3_binding::cbegin();
360 while (it != l3_binding::cend()) {
361 if (it->second.lock()->itf().key() == key())
362 it->second.lock()->replay(); //(*it->second.lock());
363 ++it;
364 }
365 } else if (!m_table_id && m_rd) {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700366 HW::enqueue(
367 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
368 HW::enqueue(
369 new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
Neale Ranns812ed392017-10-16 04:20:13 -0700370 }
371}
372
373void
Neale Ranns4ef42262018-02-20 08:10:44 -0800374interface::set(const admin_state_t& state)
375{
376 m_state = state;
377}
378
379void
Neale Ranns812ed392017-10-16 04:20:13 -0700380interface::set(const l2_address_t& addr)
381{
382 assert(rc_t::UNSET == m_l2_address.rc());
383 m_l2_address.set(rc_t::NOOP);
384 m_l2_address.update(addr);
385}
386
387void
Neale Rannsa2ee0292017-11-28 22:29:13 -0800388interface::set(const handle_t& hdl)
389{
390 m_hdl = hdl;
391}
392
393void
Neale Ranns812ed392017-10-16 04:20:13 -0700394interface::set(const oper_state_t& state)
395{
396 m_oper = state;
397}
398
Mohsin Kazmi5a4f96a2017-11-20 10:23:47 +0100399void
Neale Ranns4ef42262018-02-20 08:10:44 -0800400interface::set(const std::string& tag)
401{
402 m_tag = tag;
403}
404
405void
Mohsin Kazmi5a4f96a2017-11-20 10:23:47 +0100406interface::enable_stats_i(interface::stat_listener& el)
407{
Neale Ranns088f0e22017-12-01 00:19:43 -0800408 if (!m_stats) {
409 m_stats.reset(new interface_cmds::stats_enable_cmd(el, handle_i()));
410 HW::enqueue(m_stats);
411 HW::write();
412 }
Mohsin Kazmi5a4f96a2017-11-20 10:23:47 +0100413}
414
415void
416interface::enable_stats(interface::stat_listener& el)
417{
418 singular()->enable_stats_i(el);
419}
420
Neale Ranns812ed392017-10-16 04:20:13 -0700421std::shared_ptr<interface>
422interface::singular_i() const
423{
Neale Rannsfd920602017-11-23 12:15:00 -0800424 return (m_db.find_or_add(key(), *this));
Neale Ranns812ed392017-10-16 04:20:13 -0700425}
426
427std::shared_ptr<interface>
428interface::singular() const
429{
430 return singular_i();
431}
432
433std::shared_ptr<interface>
Neale Rannsfd920602017-11-23 12:15:00 -0800434interface::find(const key_t& k)
Neale Ranns812ed392017-10-16 04:20:13 -0700435{
Neale Rannsfd920602017-11-23 12:15:00 -0800436 return (m_db.find(k));
Neale Ranns812ed392017-10-16 04:20:13 -0700437}
438
439std::shared_ptr<interface>
440interface::find(const handle_t& handle)
441{
442 return (m_hdl_db[handle].lock());
443}
444
445void
Neale Rannsfd920602017-11-23 12:15:00 -0800446interface::add(const key_t& key, const HW::item<handle_t>& item)
Neale Ranns812ed392017-10-16 04:20:13 -0700447{
Neale Rannsfd920602017-11-23 12:15:00 -0800448 std::shared_ptr<interface> sp = find(key);
Neale Ranns812ed392017-10-16 04:20:13 -0700449
450 if (sp && item) {
451 m_hdl_db[item.data()] = sp;
452 }
453}
454
455void
456interface::remove(const HW::item<handle_t>& item)
457{
458 m_hdl_db.erase(item.data());
459}
460
461void
462interface::dump(std::ostream& os)
463{
464 m_db.dump(os);
465}
466
467void
468interface::event_handler::handle_populate(const client_db::key_t& key)
469{
Mohsin Kazmied76ee22018-03-02 12:31:37 +0100470 /*
471 * dump VPP current states
472 */
Neale Ranns4ef42262018-02-20 08:10:44 -0800473 std::shared_ptr<interface_cmds::vhost_dump_cmd> vcmd =
474 std::make_shared<interface_cmds::vhost_dump_cmd>();
475
476 HW::enqueue(vcmd);
477 HW::write();
478
479 for (auto& vhost_itf_record : *vcmd) {
480 std::shared_ptr<interface> vitf =
481 interface_factory::new_vhost_user_interface(
482 vhost_itf_record.get_payload());
Mohsin Kazmied76ee22018-03-02 12:31:37 +0100483 VOM_LOG(log_level_t::DEBUG) << " vhost-dump: " << vitf->to_string();
Neale Ranns4ef42262018-02-20 08:10:44 -0800484 OM::commit(key, *vitf);
485 }
486
Neale Ranns1d781552017-11-27 04:52:35 -0800487 std::shared_ptr<interface_cmds::dump_cmd> cmd =
488 std::make_shared<interface_cmds::dump_cmd>();
Neale Ranns812ed392017-10-16 04:20:13 -0700489
490 HW::enqueue(cmd);
491 HW::write();
492
493 for (auto& itf_record : *cmd) {
Neale Rannsa2ee0292017-11-28 22:29:13 -0800494 std::shared_ptr<interface> itf =
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700495 interface_factory::new_interface(itf_record.get_payload());
Neale Ranns812ed392017-10-16 04:20:13 -0700496
497 if (itf && interface::type_t::LOCAL != itf->type()) {
498 VOM_LOG(log_level_t::DEBUG) << "dump: " << itf->to_string();
499 /*
Neale Rannsfd920602017-11-23 12:15:00 -0800500 * Write each of the discovered interfaces into the OM,
501 * but disable the HW Command q whilst we do, so that no
502 * commands are sent to VPP
503 */
Neale Ranns812ed392017-10-16 04:20:13 -0700504 OM::commit(key, *itf);
505
506 /**
Neale Rannsfd920602017-11-23 12:15:00 -0800507 * Get the address configured on the interface
508 */
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700509 std::shared_ptr<l3_binding_cmds::dump_v4_cmd> dcmd =
510 std::make_shared<l3_binding_cmds::dump_v4_cmd>(
511 l3_binding_cmds::dump_v4_cmd(itf->handle()));
Neale Ranns812ed392017-10-16 04:20:13 -0700512
513 HW::enqueue(dcmd);
514 HW::write();
515
516 for (auto& l3_record : *dcmd) {
517 auto& payload = l3_record.get_payload();
518 const route::prefix_t pfx(payload.is_ipv6, payload.ip,
519 payload.prefix_length);
520
521 VOM_LOG(log_level_t::DEBUG) << "dump: " << pfx.to_string();
522
523 l3_binding l3(*itf, pfx);
524 OM::commit(key, l3);
525 }
526 }
527 }
Mohsin Kazmied76ee22018-03-02 12:31:37 +0100528
529 std::shared_ptr<bond_interface_cmds::dump_cmd> bcmd =
530 std::make_shared<bond_interface_cmds::dump_cmd>();
531
532 HW::enqueue(bcmd);
533 HW::write();
534
535 for (auto& bond_itf_record : *bcmd) {
536 std::shared_ptr<bond_interface> bond_itf =
537 interface_factory::new_bond_interface(bond_itf_record.get_payload());
538
539 VOM_LOG(log_level_t::DEBUG) << " bond-dump:" << bond_itf->to_string();
540
541 /*
542 * Write each of the discovered interfaces into the OM,
543 * but disable the HW Command q whilst we do, so that no
544 * commands are sent to VPP
545 */
546 OM::commit(key, *bond_itf);
547
548 std::shared_ptr<bond_group_binding_cmds::dump_cmd> scmd =
549 std::make_shared<bond_group_binding_cmds::dump_cmd>(
550 bond_group_binding_cmds::dump_cmd(bond_itf->handle()));
551
552 HW::enqueue(scmd);
553 HW::write();
554
555 bond_group_binding::enslaved_itf_t enslaved_itfs;
556
557 for (auto& slave_itf_record : *scmd) {
558 bond_member slave_itf = interface_factory::new_bond_member_interface(
559 slave_itf_record.get_payload());
560
561 VOM_LOG(log_level_t::DEBUG) << " slave-dump:" << slave_itf.to_string();
562
563 /*
564 * Write each of the discovered interfaces into the OM,
565 * but disable the HW Command q whilst we do, so that no
566 * commands are sent to VPP
567 */
568 // OM::commit(slave_itf->key(), *slave_itf);
569 enslaved_itfs.insert(slave_itf);
570 }
571
572 if (!enslaved_itfs.empty()) {
573 bond_group_binding bid(*bond_itf, enslaved_itfs);
574 /*
575 * Write each of the discovered interfaces into the OM,
576 * but disable the HW Command q whilst we do, so that no
577 * commands are sent to VPP
578 */
579 OM::commit(key, bid);
580 }
581 }
Neale Ranns812ed392017-10-16 04:20:13 -0700582}
583
584interface::event_handler::event_handler()
585{
586 OM::register_listener(this);
587 inspect::register_handler({ "interface", "intf" }, "interfaces", this);
588}
589
590void
591interface::event_handler::handle_replay()
592{
593 m_db.replay();
594}
595
596dependency_t
597interface::event_handler::order() const
598{
599 return (dependency_t::INTERFACE);
600}
601
602void
603interface::event_handler::show(std::ostream& os)
604{
605 m_db.dump(os);
606}
Neale Rannsfd920602017-11-23 12:15:00 -0800607
608} // namespace VOM
609
Neale Ranns812ed392017-10-16 04:20:13 -0700610/*
611 * fd.io coding-style-patch-verification: ON
612 *
613 * Local Variables:
614 * eval: (c-set-style "mozilla")
615 * End:
616 */