summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/if.c b/lib/if.c
index f03574e787..07e786c708 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -383,6 +383,17 @@ struct interface *if_lookup_by_name(const char *name, vrf_id_t vrf_id)
return RB_FIND(if_name_head, &vrf->ifaces_by_name, &if_tmp);
}
+struct interface *if_lookup_by_name_vrf(const char *name, struct vrf *vrf)
+{
+ struct interface if_tmp;
+
+ if (!name || strnlen(name, INTERFACE_NAMSIZ) == INTERFACE_NAMSIZ)
+ return NULL;
+
+ strlcpy(if_tmp.name, name, sizeof(if_tmp.name));
+ return RB_FIND(if_name_head, &vrf->ifaces_by_name, &if_tmp);
+}
+
struct interface *if_lookup_by_name_all_vrf(const char *name)
{
struct vrf *vrf;
@@ -774,8 +785,7 @@ static void if_dump(const struct interface *ifp)
struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
zlog_info(
- "Interface %s vrf %s(%u) index %d metric %d mtu %d "
- "mtu6 %d %s",
+ "Interface %s vrf %s(%u) index %d metric %d mtu %d mtu6 %d %s",
ifp->name, VRF_LOGNAME(vrf), ifp->vrf_id, ifp->ifindex,
ifp->metric, ifp->mtu, ifp->mtu6,
if_flag_dump(ifp->flags));
@@ -1311,7 +1321,7 @@ void if_link_params_free(struct interface *ifp)
/*
* XPath: /frr-interface:lib/interface
*/
-DEFPY_NOSH (interface,
+DEFPY_YANG_NOSH (interface,
interface_cmd,
"interface IFNAME [vrf NAME$vrf_name]",
"Select an interface to configure\n"
@@ -1374,6 +1384,7 @@ DEFPY_NOSH (interface,
* all interface-level commands are converted to the new
* northbound model.
*/
+ nb_cli_pending_commit_check(vty);
ifp = if_lookup_by_name(ifname, vrf_id);
if (ifp)
VTY_PUSH_CONTEXT(INTERFACE_NODE, ifp);
@@ -1382,7 +1393,7 @@ DEFPY_NOSH (interface,
return ret;
}
-DEFPY (no_interface,
+DEFPY_YANG (no_interface,
no_interface_cmd,
"no interface IFNAME [vrf NAME$vrf_name]",
NO_STR
@@ -1417,7 +1428,7 @@ static void cli_show_interface(struct vty *vty, struct lyd_node *dnode,
/*
* XPath: /frr-interface:lib/interface/description
*/
-DEFPY (interface_desc,
+DEFPY_YANG (interface_desc,
interface_desc_cmd,
"description LINE...",
"Interface specific description\n"
@@ -1434,7 +1445,7 @@ DEFPY (interface_desc,
return ret;
}
-DEFPY (no_interface_desc,
+DEFPY_YANG (no_interface_desc,
no_interface_desc_cmd,
"no description",
NO_STR