aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJunfeng Wang <drenfong.wang@intel.com>2019-09-19 10:56:34 +0800
committerJunfeng Wang <drenfong.wang@intel.com>2019-09-19 11:37:59 +0800
commit01ea3061fb98ed851aa913e36ade1dddf5ed9389 (patch)
tree10decdbc9236a5fe4d27a728d56326602866b106 /src
parent55de4df2fc5231334fd022cb1aa4508cd5ec770b (diff)
fix api changev20.01-rc0
Change-Id: If9f628c8287567a93b065c351da1cb272953a68c Signed-off-by: Junfeng Wang <drenfong.wang@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/ietf/ietf_interface.cpp18
-rw-r--r--src/plugins/openconfig/openconfig_interfaces.cpp8
-rw-r--r--src/plugins/vpp-oper/interface.cpp3
3 files changed, 17 insertions, 12 deletions
diff --git a/src/plugins/ietf/ietf_interface.cpp b/src/plugins/ietf/ietf_interface.cpp
index 0fedbf9..86f8e73 100644
--- a/src/plugins/ietf/ietf_interface.cpp
+++ b/src/plugins/ietf/ietf_interface.cpp
@@ -407,25 +407,27 @@ ietf_interface_state_cb(const char *xpath, sr_val_t **values,
for (auto &it : *dump) {
interface = it.get_payload();
- SRP_LOG_DBG("State of interface %s", interface.interface_name.buf);
+ SRP_LOG_DBG("State of interface %s", interface.interface_name);
/* it needs if-mib YANG feature to work !
* admin-state: state as required by configuration */
sr_val_build_xpath(&val[cnt], "%s[name='%s']/admin-status", xpath,
- interface.interface_name.buf);
+ interface.interface_name);
sr_val_set_str_data(&val[cnt], SR_ENUM_T,
- interface.flags? "up" : "down");
+ (interface.flags == vapi_enum_if_status_flags::IF_STATUS_API_FLAG_ADMIN_UP) ?
+ "up" : "down");
cnt++;
/* oper-state: effective state. can differ from admin-state */
sr_val_build_xpath(&val[cnt], "%s[name='%s']/oper-status", xpath,
- interface.interface_name.buf);
+ interface.interface_name);
sr_val_set_str_data(&val[cnt], SR_ENUM_T,
- interface.link_duplex ? "up" : "down");
+ (interface.flags == vapi_enum_if_status_flags::IF_STATUS_API_FLAG_LINK_UP) ?
+ "up" : "down");
cnt++;
sr_val_build_xpath(&val[cnt], "%s[name='%s']/phys-address", xpath,
- interface.interface_name.buf);
+ interface.interface_name);
sr_val_build_str_data(&val[cnt], SR_STRING_T,
"%02x:%02x:%02x:%02x:%02x:%02x",
interface.l2_address[0], interface.l2_address[1],
@@ -434,13 +436,13 @@ ietf_interface_state_cb(const char *xpath, sr_val_t **values,
cnt++;
sr_val_build_xpath(&val[cnt], "%s[name='%s']/if-index", xpath,
- interface.interface_name.buf);
+ interface.interface_name);
val[cnt].type = SR_INT32_T;
val[cnt].data.int32_val = interface.sw_if_index;
cnt++;
sr_val_build_xpath(&val[cnt], "%s[name='%s']/speed", xpath,
- interface.interface_name.buf);
+ interface.interface_name);
val[cnt].type = SR_UINT64_T;
val[cnt].data.uint64_val = interface.link_speed;
cnt++;
diff --git a/src/plugins/openconfig/openconfig_interfaces.cpp b/src/plugins/openconfig/openconfig_interfaces.cpp
index 2f09a2a..a23841c 100644
--- a/src/plugins/openconfig/openconfig_interfaces.cpp
+++ b/src/plugins/openconfig/openconfig_interfaces.cpp
@@ -235,7 +235,7 @@ oc_interfaces_state_cb(const char *xpath, sr_val_t **values, size_t *values_cnt,
reply = dump->begin()->get_payload();
sr_val_build_xpath(&vals[cnt], "%s/name", xpath_root);
- sr_val_set_str_data(&vals[cnt], SR_STRING_T, (char *)reply.interface_name.buf);
+ sr_val_set_str_data(&vals[cnt], SR_STRING_T, (char *)reply.interface_name);
cnt++;
//TODO revisit types after V3PO has been implemented
@@ -260,12 +260,14 @@ oc_interfaces_state_cb(const char *xpath, sr_val_t **values, size_t *values_cnt,
sr_val_build_xpath(&vals[cnt], "%s/admin-status", xpath_root);
sr_val_set_str_data(&vals[cnt], SR_ENUM_T,
- reply.flags ? "UP" : "DOWN");
+ (reply.flags == vapi_enum_if_status_flags::IF_STATUS_API_FLAG_ADMIN_UP) ?
+ "UP" : "DOWN");
cnt++;
sr_val_build_xpath(&vals[cnt], "%s/oper-status", xpath_root);
sr_val_set_str_data(&vals[cnt], SR_ENUM_T,
- reply.link_duplex ? "UP" : "DOWN");
+ (reply.flags == vapi_enum_if_status_flags::IF_STATUS_API_FLAG_LINK_UP) ?
+ "UP" : "DOWN");
cnt++;
*values = vals;
diff --git a/src/plugins/vpp-oper/interface.cpp b/src/plugins/vpp-oper/interface.cpp
index 263f56e..eee14e0 100644
--- a/src/plugins/vpp-oper/interface.cpp
+++ b/src/plugins/vpp-oper/interface.cpp
@@ -22,7 +22,8 @@ interface_dump::issue(connection& con)
payload.name_filter_valid = 0;
} else {
payload.name_filter_valid = 1;
- strcpy((char*)payload.name_filter.buf, m_name.c_str());
+ memset(payload.name_filter.buf, 0, payload.name_filter.length);
+ memcpy(payload.name_filter.buf, m_name.c_str(), m_name.length());
}
VAPI_CALL(m_dump->execute());