aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-03-01 08:55:49 +0100
committerOle Trøan <otroan@employees.org>2019-03-15 10:24:22 +0000
commite63325e3ca03c847963863446345e6c80a2c0cfd (patch)
treecae33764e6186727697e91862c32f2b08334866b /extras
parent4ba4edd15085ce31145ef5da6342e435c57c1150 (diff)
API: Cleanup APIs interface.api
Use of consistent API types for interface.api Change-Id: Ieb54cebb4ac96b432a3f0b41596718aa2f34885b Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/vom/vom/interface.cpp4
-rw-r--r--extras/vom/vom/interface_cmds.cpp10
-rw-r--r--extras/vom/vom/interface_factory.cpp12
-rw-r--r--extras/vom/vom/l3_binding_cmds.cpp8
4 files changed, 19 insertions, 15 deletions
diff --git a/extras/vom/vom/interface.cpp b/extras/vom/vom/interface.cpp
index ec6204f1e0c..15bc3733ec4 100644
--- a/extras/vom/vom/interface.cpp
+++ b/extras/vom/vom/interface.cpp
@@ -634,8 +634,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 3a7fb50f64b..7805fdb1a1d 100644
--- a/extras/vom/vom/interface_cmds.cpp
+++ b/extras/vom/vom/interface_cmds.cpp
@@ -252,7 +252,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());
@@ -450,8 +450,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();
@@ -569,8 +569,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..30bd4726886 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.address_length);
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.address_length);
VAPI_CALL(req.execute());