* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
-
-
#include "lib/zebra.h"
#include "lib/command.h"
DEFINE_MTYPE(RFAPI, RFAPI_AP, "RFAPI Advertised Prefix")
DEFINE_MTYPE(RFAPI, RFAPI_MONITOR_ETH, "RFAPI Monitor Ethernet")
+DEFINE_QOBJ_TYPE(rfapi_nve_group_cfg)
+DEFINE_QOBJ_TYPE(rfapi_l2_group_cfg)
/***********************************************************************
* RFAPI Support
***********************************************************************/
"IPv6 routes\n" "Prefix-list for filtering redistributed routes\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg)
afi_t afi;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"prefix list name\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
afi_t afi;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Route-map for filtering redistributed routes\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
if (!bgp)
{
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Route-map for filtering exported routes\n" "route map name\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
if (!bgp)
{
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Prefix-list for filtering exported routes\n" "prefix list name\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
afi_t afi;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Prefix-list for filtering exported routes\n" "prefix list name\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
afi_t afi;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Route-map for filtering exported routes\n" "route map name\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
if (!bgp)
{
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Route-map for filtering exported routes\n" "route map name\n")
{
struct bgp *bgp = vty->index;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
if (!bgp)
{
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
* XXX subsequent calls will need to make sure this item is still
* in the linked list and has the same name
*/
- vty->index_sub = rfg;
+ VTY_PUSH_CONTEXT_SUB (BGP_VNC_NVE_GROUP_NODE, rfg);
- vty->node = BGP_VNC_NVE_GROUP_NODE;
return CMD_SUCCESS;
}
"IPv4 prefix\n"
"IPv6 prefix\n")
{
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct prefix p;
int afi;
struct route_table *rt;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Import filter\n"
"Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n")
{
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct bgp *bgp = vty->index;
int rc;
struct listnode *node;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Export filter\n"
"Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n")
{
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct bgp *bgp = vty->index;
int rc;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Export+import filters\n"
"Space separated route target list (A.B.C.D:MN|EF:OPQR|GHJK:MN)\n")
{
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct bgp *bgp = vty->index;
int rc;
int is_export_bgp = 0;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Fixed value 1-255\n"
"use the low-order octet of the NVE's VN address\n")
{
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct bgp *bgp = vty->index;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
NO_STR
"Specify default Local Nve ID value to use in RD for L2 routes\n")
{
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct bgp *bgp = vty->index;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
{
int ret;
struct prefix_rd prd;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct bgp *bgp = vty->index;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
"Response lifetime in seconds\n" "Infinite response lifetime\n")
{
unsigned int rspint;
- struct rfapi_nve_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_nve_group_cfg, rfg);
struct bgp *bgp = vty->index;
struct rfapi_descriptor *rfd;
struct listnode *hdnode;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->nve_groups_sequential, rfg))
{
* XXX subsequent calls will need to make sure this item is still
* in the linked list and has the same name
*/
- vty->index_sub = rfg;
-
- vty->node = BGP_VNC_L2_GROUP_NODE;
+ VTY_PUSH_CONTEXT_SUB (BGP_VNC_L2_GROUP_NODE, rfg);
return CMD_SUCCESS;
}
"Specify Logical Network ID associated with group\n"
"value\n")
{
- struct rfapi_l2_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg);
struct bgp *bgp = vty->index;
if (!bgp)
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg))
{
"Specify label values associated with group\n"
"Space separated list of label values <0-1048575>\n")
{
- struct rfapi_l2_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg);
struct bgp *bgp = vty->index;
struct list *ll;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg))
{
"Specify label values associated with L2 group\n"
"Space separated list of label values <0-1048575>\n")
{
- struct rfapi_l2_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg);
struct bgp *bgp = vty->index;
struct list *ll;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg))
{
"Import filters\n"
"A route target\n")
{
- struct rfapi_l2_group_cfg *rfg;
+ VTY_DECLVAR_CONTEXT_SUB(rfapi_l2_group_cfg, rfg);
struct bgp *bgp = vty->index;
int rc = CMD_SUCCESS;
int do_import = 0;
return CMD_WARNING;
}
- /* get saved pointer */
- rfg = vty->index_sub;
-
/* make sure it's still in list */
if (!listnode_lookup (bgp->rfapi_cfg->l2_groups, rfg))
{