diff options
author | Jakub Grajciar <jgrajcia@cisco.com> | 2019-03-18 13:17:53 +0100 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-08-20 09:57:10 +0000 |
commit | 053204ab039d34a990ff0e14c32ce3b294fcce0e (patch) | |
tree | 7261eaf0b905ea456ac536d8f728e89319b16a69 /extras | |
parent | df36f4963f1a590ce9a02f048507c3d4590580ae (diff) |
api: Cleanup APIs interface.api
Use of consistent API types for interface.api
Type: fix
Change-Id: I88206d7d0907cffd564031f73c9a996df2e5e21a
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/vom/vom/interface.cpp | 4 | ||||
-rw-r--r-- | extras/vom/vom/interface_cmds.cpp | 10 | ||||
-rw-r--r-- | extras/vom/vom/interface_factory.cpp | 12 | ||||
-rw-r--r-- | extras/vom/vom/l3_binding_cmds.cpp | 8 |
4 files changed, 19 insertions, 15 deletions
diff --git a/extras/vom/vom/interface.cpp b/extras/vom/vom/interface.cpp index 70035648d06..c80dc793604 100644 --- a/extras/vom/vom/interface.cpp +++ b/extras/vom/vom/interface.cpp @@ -647,8 +647,8 @@ interface::event_handler::handle_populate(const client_db::key_t& key) for (auto& itf_record : *cmd) { auto payload = itf_record.get_payload(); VOM_LOG(log_level_t::DEBUG) << "dump: [" << payload.sw_if_index - << " name:" << (char*)payload.interface_name - << " tag:" << (char*)payload.tag << "]"; + << " name:" << (char*)payload.interface_name.buf + << " tag:" << (char*)payload.tag.buf << "]"; std::shared_ptr<interface> itf = interface_factory::new_interface(payload); diff --git a/extras/vom/vom/interface_cmds.cpp b/extras/vom/vom/interface_cmds.cpp index b72c2ad69e5..8c47b9f4c45 100644 --- a/extras/vom/vom/interface_cmds.cpp +++ b/extras/vom/vom/interface_cmds.cpp @@ -318,7 +318,7 @@ state_change_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.sw_if_index = m_hdl.data().value(); - payload.admin_up_down = m_hw_item.data().value(); + payload.flags = (vapi_enum_if_status_flags)m_hw_item.data().value(); VAPI_CALL(req.execute()); @@ -516,8 +516,8 @@ events_cmd::notify() std::shared_ptr<interface> sp = interface::find(handle); if (sp) { - interface::oper_state_t oper_state = - interface::oper_state_t::from_int(payload.link_up_down); + interface::oper_state_t oper_state = interface::oper_state_t::from_int( + payload.flags & vapi_enum_if_status_flags::IF_STATUS_API_FLAG_LINK_UP); VOM_LOG(log_level_t::DEBUG) << "Interface Event: " << sp->to_string() << " state: " << oper_state.to_string(); @@ -635,8 +635,8 @@ set_tag::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.is_add = 1; payload.sw_if_index = m_hw_item.data().value(); - memset(payload.tag, 0, sizeof(payload.tag)); - memcpy(payload.tag, m_name.c_str(), m_name.length()); + memset(payload.tag.buf, 0, payload.tag.length); + memcpy(payload.tag.buf, m_name.c_str(), m_name.length()); VAPI_CALL(req.execute()); diff --git a/extras/vom/vom/interface_factory.cpp b/extras/vom/vom/interface_factory.cpp index abb26f84a6f..750df96b025 100644 --- a/extras/vom/vom/interface_factory.cpp +++ b/extras/vom/vom/interface_factory.cpp @@ -30,12 +30,12 @@ interface_factory::new_interface(const vapi_payload_sw_interface_details& vd) /** * Determine the interface type from the name and VLAN attributes */ - std::string name = reinterpret_cast<const char*>(vd.interface_name); + std::string name = reinterpret_cast<const char*>(vd.interface_name.buf); interface::type_t type = interface::type_t::from_string(name); - interface::admin_state_t state = - interface::admin_state_t::from_int(vd.admin_up_down); + interface::admin_state_t state = interface::admin_state_t::from_int( + vd.flags & vapi_enum_if_status_flags::IF_STATUS_API_FLAG_ADMIN_UP); handle_t hdl(vd.sw_if_index); - l2_address_t l2_address(vd.l2_address, vd.l2_address_length); + l2_address_t l2_address(vd.l2_address, 6); std::string tag = ""; if (interface::type_t::UNKNOWN == type) { @@ -64,8 +64,8 @@ interface_factory::new_interface(const vapi_payload_sw_interface_details& vd) * if the tag is set, then we wrote that to specify a name to make * the interface type more specific */ - if (vd.tag[0] != 0) { - tag = std::string(reinterpret_cast<const char*>(vd.tag)); + if (vd.tag.buf[0] != 0) { + tag = std::string(reinterpret_cast<const char*>(vd.tag.buf)); } if (!tag.empty() && interface::type_t::LOOPBACK == type) { diff --git a/extras/vom/vom/l3_binding_cmds.cpp b/extras/vom/vom/l3_binding_cmds.cpp index 4afe13e1076..15122bc9dd6 100644 --- a/extras/vom/vom/l3_binding_cmds.cpp +++ b/extras/vom/vom/l3_binding_cmds.cpp @@ -44,7 +44,9 @@ bind_cmd::issue(connection& con) payload.is_add = 1; payload.del_all = 0; - m_pfx.to_vpp(&payload.is_ipv6, payload.address, &payload.address_length); + m_pfx.to_vpp((uint8_t*)&payload.prefix.address.af, + (uint8_t*)&payload.prefix.address, + (uint8_t*)&payload.prefix.len); VAPI_CALL(req.execute()); @@ -86,7 +88,9 @@ unbind_cmd::issue(connection& con) payload.is_add = 0; payload.del_all = 0; - m_pfx.to_vpp(&payload.is_ipv6, payload.address, &payload.address_length); + m_pfx.to_vpp((uint8_t*)&payload.prefix.address.af, + (uint8_t*)&payload.prefix.address, + (uint8_t*)&payload.prefix.len); VAPI_CALL(req.execute()); |