forked from Mirror/frr
lib:api to convert mac to yang object
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
parent
ce45ffe73b
commit
dd9ef518bf
|
@ -1114,3 +1114,17 @@ void yang_get_default_ip(struct ipaddr *var, const char *xpath_fmt, ...)
|
||||||
value = yang_get_default_value(xpath);
|
value = yang_get_default_value(xpath);
|
||||||
yang_str2ip(value, var);
|
yang_str2ip(value, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct yang_data *yang_data_new_mac(const char *xpath,
|
||||||
|
const struct ethaddr *mac)
|
||||||
|
{
|
||||||
|
char value_str[ETHER_ADDR_STRLEN];
|
||||||
|
|
||||||
|
prefix_mac2str(mac, value_str, sizeof(value_str));
|
||||||
|
return yang_data_new(xpath, value_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void yang_str2mac(const char *value, struct ethaddr *mac)
|
||||||
|
{
|
||||||
|
(void)prefix_str2mac(value, mac);
|
||||||
|
}
|
||||||
|
|
|
@ -172,4 +172,9 @@ extern void yang_dnode_get_ip(struct ipaddr *addr, const struct lyd_node *dnode,
|
||||||
const char *xpath_fmt, ...);
|
const char *xpath_fmt, ...);
|
||||||
extern void yang_get_default_ip(struct ipaddr *var, const char *xpath_fmt, ...);
|
extern void yang_get_default_ip(struct ipaddr *var, const char *xpath_fmt, ...);
|
||||||
|
|
||||||
|
/* mac */
|
||||||
|
extern struct yang_data *yang_data_new_mac(const char *xpath,
|
||||||
|
const struct ethaddr *mac);
|
||||||
|
extern void yang_str2mac(const char *value, struct ethaddr *mac);
|
||||||
|
|
||||||
#endif /* _FRR_NORTHBOUND_WRAPPERS_H_ */
|
#endif /* _FRR_NORTHBOUND_WRAPPERS_H_ */
|
||||||
|
|
Loading…
Reference in a new issue