mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 21:54:01 +00:00
Merge pull request #5851 from volta-networks/feat_ldp_oc_review
ldpd: adding support for LDP ordered label distribution control
This commit is contained in:
commit
1a3ff5236c
@ -108,6 +108,11 @@ LDP Configuration
|
|||||||
The following command located under MPLS router node configures the MPLS
|
The following command located under MPLS router node configures the MPLS
|
||||||
router-id of the local device.
|
router-id of the local device.
|
||||||
|
|
||||||
|
.. index:: [no] ordered-control
|
||||||
|
.. clicmd:: [no] ordered-control
|
||||||
|
|
||||||
|
Configure LDP Ordered Label Distribution Control.
|
||||||
|
|
||||||
.. index:: [no] address-family [ipv4 | ipv6]
|
.. index:: [no] address-family [ipv4 | ipv6]
|
||||||
.. clicmd:: [no] address-family [ipv4 | ipv6]
|
.. clicmd:: [no] address-family [ipv4 | ipv6]
|
||||||
|
|
||||||
|
90
ldpd/lde.c
90
ldpd/lde.c
@ -61,6 +61,8 @@ static void lde_label_list_init(void);
|
|||||||
static int lde_get_label_chunk(void);
|
static int lde_get_label_chunk(void);
|
||||||
static void on_get_label_chunk_response(uint32_t start, uint32_t end);
|
static void on_get_label_chunk_response(uint32_t start, uint32_t end);
|
||||||
static uint32_t lde_get_next_label(void);
|
static uint32_t lde_get_next_label(void);
|
||||||
|
static bool lde_fec_connected(const struct fec_node *);
|
||||||
|
static bool lde_fec_outside_mpls_network(const struct fec_node *);
|
||||||
|
|
||||||
RB_GENERATE(nbr_tree, lde_nbr, entry, lde_nbr_compare)
|
RB_GENERATE(nbr_tree, lde_nbr, entry, lde_nbr_compare)
|
||||||
RB_GENERATE(lde_map_head, lde_map, entry, lde_map_compare)
|
RB_GENERATE(lde_map_head, lde_map, entry, lde_map_compare)
|
||||||
@ -658,18 +660,31 @@ lde_acl_check(char *acl_name, int af, union ldpd_addr *addr, uint8_t prefixlen)
|
|||||||
return ldp_acl_request(iev_main_sync, acl_name, af, addr, prefixlen);
|
return ldp_acl_request(iev_main_sync, acl_name, af, addr, prefixlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool lde_fec_connected(const struct fec_node *fn)
|
||||||
|
{
|
||||||
|
struct fec_nh *fnh;
|
||||||
|
|
||||||
|
LIST_FOREACH(fnh, &fn->nexthops, entry)
|
||||||
|
if (fnh->flags & F_FEC_NH_CONNECTED)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool lde_fec_outside_mpls_network(const struct fec_node *fn)
|
||||||
|
{
|
||||||
|
struct fec_nh *fnh;
|
||||||
|
|
||||||
|
LIST_FOREACH(fnh, &fn->nexthops, entry)
|
||||||
|
if (!(fnh->flags & F_FEC_NH_NO_LDP))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
lde_update_label(struct fec_node *fn)
|
lde_update_label(struct fec_node *fn)
|
||||||
{
|
{
|
||||||
struct fec_nh *fnh;
|
|
||||||
int connected = 0;
|
|
||||||
|
|
||||||
LIST_FOREACH(fnh, &fn->nexthops, entry) {
|
|
||||||
if (fnh->flags & F_FEC_NH_CONNECTED) {
|
|
||||||
connected = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* should we allocate a label for this fec? */
|
/* should we allocate a label for this fec? */
|
||||||
switch (fn->fec.type) {
|
switch (fn->fec.type) {
|
||||||
@ -695,7 +710,14 @@ lde_update_label(struct fec_node *fn)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connected) {
|
/*
|
||||||
|
* If connected interface act as egress for fec.
|
||||||
|
* If LDP is not configured on an interface but there
|
||||||
|
* are other NHs with interfaces configured with LDP
|
||||||
|
* then don't act as an egress for the fec, otherwise
|
||||||
|
* act as an egress for the fec
|
||||||
|
*/
|
||||||
|
if (lde_fec_connected(fn) || lde_fec_outside_mpls_network(fn)) {
|
||||||
/* choose implicit or explicit-null depending on configuration */
|
/* choose implicit or explicit-null depending on configuration */
|
||||||
switch (fn->fec.type) {
|
switch (fn->fec.type) {
|
||||||
case FEC_TYPE_IPV4:
|
case FEC_TYPE_IPV4:
|
||||||
@ -735,6 +757,13 @@ lde_send_change_klabel(struct fec_node *fn, struct fec_nh *fnh)
|
|||||||
struct zapi_pw zpw;
|
struct zapi_pw zpw;
|
||||||
struct l2vpn_pw *pw;
|
struct l2vpn_pw *pw;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ordered Control: don't program label into HW until a
|
||||||
|
* labelmap msg has been received from upstream router
|
||||||
|
*/
|
||||||
|
if (fnh->flags & F_FEC_NH_DEFER)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (fn->fec.type) {
|
switch (fn->fec.type) {
|
||||||
case FEC_TYPE_IPV4:
|
case FEC_TYPE_IPV4:
|
||||||
memset(&kr, 0, sizeof(kr));
|
memset(&kr, 0, sizeof(kr));
|
||||||
@ -901,6 +930,27 @@ lde_send_labelmapping(struct lde_nbr *ln, struct fec_node *fn, int single)
|
|||||||
struct lde_req *lre;
|
struct lde_req *lre;
|
||||||
struct map map;
|
struct map map;
|
||||||
struct l2vpn_pw *pw;
|
struct l2vpn_pw *pw;
|
||||||
|
struct fec_nh *fnh;
|
||||||
|
bool allow = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ordered Control: do not send a labelmap msg until
|
||||||
|
* a labelmap message is received from downstream router
|
||||||
|
* and don't send labelmap back to downstream router
|
||||||
|
*/
|
||||||
|
if (ldeconf->flags & F_LDPD_ORDERED_CONTROL) {
|
||||||
|
LIST_FOREACH(fnh, &fn->nexthops, entry) {
|
||||||
|
if (fnh->flags & F_FEC_NH_DEFER)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (lde_address_find(ln, fnh->af, &fnh->nexthop))
|
||||||
|
return;
|
||||||
|
allow = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!allow)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We shouldn't send a new label mapping if we have a pending
|
* We shouldn't send a new label mapping if we have a pending
|
||||||
@ -1241,6 +1291,7 @@ lde_nbr_del(struct lde_nbr *ln)
|
|||||||
struct fec_node *fn;
|
struct fec_node *fn;
|
||||||
struct fec_nh *fnh;
|
struct fec_nh *fnh;
|
||||||
struct l2vpn_pw *pw;
|
struct l2vpn_pw *pw;
|
||||||
|
struct lde_nbr *lnbr;
|
||||||
|
|
||||||
if (ln == NULL)
|
if (ln == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1256,6 +1307,25 @@ lde_nbr_del(struct lde_nbr *ln)
|
|||||||
if (!lde_address_find(ln, fnh->af,
|
if (!lde_address_find(ln, fnh->af,
|
||||||
&fnh->nexthop))
|
&fnh->nexthop))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ordered Control: must mark any non-connected
|
||||||
|
* NH to wait until we receive a labelmap msg
|
||||||
|
* before installing in kernel and sending to
|
||||||
|
* peer, must do this as NHs are not removed
|
||||||
|
* when lsps go down. Also send label withdraw
|
||||||
|
* to other neighbors for all fecs from neighbor
|
||||||
|
* going down
|
||||||
|
*/
|
||||||
|
if (ldeconf->flags & F_LDPD_ORDERED_CONTROL) {
|
||||||
|
fnh->flags |= F_FEC_NH_DEFER;
|
||||||
|
|
||||||
|
RB_FOREACH(lnbr, nbr_tree, &lde_nbrs) {
|
||||||
|
if (ln->peerid == lnbr->peerid)
|
||||||
|
continue;
|
||||||
|
lde_send_labelwithdraw(lnbr, fn, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FEC_TYPE_PWID:
|
case FEC_TYPE_PWID:
|
||||||
if (f->u.pwid.lsr_id.s_addr != ln->id.s_addr)
|
if (f->u.pwid.lsr_id.s_addr != ln->id.s_addr)
|
||||||
|
@ -114,6 +114,8 @@ struct fec_nh {
|
|||||||
};
|
};
|
||||||
#define F_FEC_NH_NEW 0x01
|
#define F_FEC_NH_NEW 0x01
|
||||||
#define F_FEC_NH_CONNECTED 0x02
|
#define F_FEC_NH_CONNECTED 0x02
|
||||||
|
#define F_FEC_NH_DEFER 0x04 /* running ordered control */
|
||||||
|
#define F_FEC_NH_NO_LDP 0x08 /* no ldp on this interface */
|
||||||
|
|
||||||
struct fec_node {
|
struct fec_node {
|
||||||
struct fec fec;
|
struct fec fec;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <zebra.h>
|
#include <zebra.h>
|
||||||
|
|
||||||
#include "ldpd.h"
|
#include "ldpd.h"
|
||||||
|
#include "ldpe.h"
|
||||||
#include "lde.h"
|
#include "lde.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
@ -325,6 +326,7 @@ lde_kernel_insert(struct fec *fec, int af, union ldpd_addr *nexthop,
|
|||||||
{
|
{
|
||||||
struct fec_node *fn;
|
struct fec_node *fn;
|
||||||
struct fec_nh *fnh;
|
struct fec_nh *fnh;
|
||||||
|
struct iface *iface;
|
||||||
|
|
||||||
fn = (struct fec_node *)fec_find(&ft, fec);
|
fn = (struct fec_node *)fec_find(&ft, fec);
|
||||||
if (fn == NULL)
|
if (fn == NULL)
|
||||||
@ -333,9 +335,21 @@ lde_kernel_insert(struct fec *fec, int af, union ldpd_addr *nexthop,
|
|||||||
fn->data = data;
|
fn->data = data;
|
||||||
|
|
||||||
fnh = fec_nh_find(fn, af, nexthop, ifindex, route_type, route_instance);
|
fnh = fec_nh_find(fn, af, nexthop, ifindex, route_type, route_instance);
|
||||||
if (fnh == NULL)
|
if (fnh == NULL) {
|
||||||
fnh = fec_nh_add(fn, af, nexthop, ifindex, route_type,
|
fnh = fec_nh_add(fn, af, nexthop, ifindex, route_type,
|
||||||
route_instance);
|
route_instance);
|
||||||
|
/*
|
||||||
|
* Ordered Control: if not a connected route and not a route
|
||||||
|
* learned over an interface not running LDP and not a PW
|
||||||
|
* then mark to wait until we receive labelmap msg before
|
||||||
|
* installing in kernel and sending to peer
|
||||||
|
*/
|
||||||
|
iface = if_lookup(ldeconf, ifindex);
|
||||||
|
if ((ldeconf->flags & F_LDPD_ORDERED_CONTROL) &&
|
||||||
|
!connected && iface != NULL && fec->type != FEC_TYPE_PWID)
|
||||||
|
fnh->flags |= F_FEC_NH_DEFER;
|
||||||
|
}
|
||||||
|
|
||||||
fnh->flags |= F_FEC_NH_NEW;
|
fnh->flags |= F_FEC_NH_NEW;
|
||||||
if (connected)
|
if (connected)
|
||||||
fnh->flags |= F_FEC_NH_CONNECTED;
|
fnh->flags |= F_FEC_NH_CONNECTED;
|
||||||
@ -374,15 +388,25 @@ lde_kernel_update(struct fec *fec)
|
|||||||
struct fec_nh *fnh, *safe;
|
struct fec_nh *fnh, *safe;
|
||||||
struct lde_nbr *ln;
|
struct lde_nbr *ln;
|
||||||
struct lde_map *me;
|
struct lde_map *me;
|
||||||
|
struct iface *iface;
|
||||||
|
|
||||||
fn = (struct fec_node *)fec_find(&ft, fec);
|
fn = (struct fec_node *)fec_find(&ft, fec);
|
||||||
if (fn == NULL)
|
if (fn == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIST_FOREACH_SAFE(fnh, &fn->nexthops, entry, safe) {
|
LIST_FOREACH_SAFE(fnh, &fn->nexthops, entry, safe) {
|
||||||
if (fnh->flags & F_FEC_NH_NEW)
|
if (fnh->flags & F_FEC_NH_NEW) {
|
||||||
fnh->flags &= ~F_FEC_NH_NEW;
|
fnh->flags &= ~F_FEC_NH_NEW;
|
||||||
else {
|
/*
|
||||||
|
* if LDP configured on interface or a static route
|
||||||
|
* clear flag else treat fec as a connected route
|
||||||
|
*/
|
||||||
|
iface = if_lookup(ldeconf,fnh->ifindex);
|
||||||
|
if (iface || fnh->route_type == ZEBRA_ROUTE_STATIC)
|
||||||
|
fnh->flags &=~F_FEC_NH_NO_LDP;
|
||||||
|
else
|
||||||
|
fnh->flags |= F_FEC_NH_NO_LDP;
|
||||||
|
} else {
|
||||||
lde_send_delete_klabel(fn, fnh);
|
lde_send_delete_klabel(fn, fnh);
|
||||||
fec_nh_del(fnh);
|
fec_nh_del(fnh);
|
||||||
}
|
}
|
||||||
@ -445,6 +469,7 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln)
|
|||||||
struct lde_req *lre;
|
struct lde_req *lre;
|
||||||
struct lde_map *me;
|
struct lde_map *me;
|
||||||
struct l2vpn_pw *pw;
|
struct l2vpn_pw *pw;
|
||||||
|
bool send_map = false;
|
||||||
|
|
||||||
lde_map2fec(map, ln->id, &fec);
|
lde_map2fec(map, ln->id, &fec);
|
||||||
|
|
||||||
@ -525,6 +550,15 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln)
|
|||||||
if (!lde_address_find(ln, fnh->af, &fnh->nexthop))
|
if (!lde_address_find(ln, fnh->af, &fnh->nexthop))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ordered Control: labelmap msg received from
|
||||||
|
* NH so clear flag and send labelmap msg to
|
||||||
|
* peer
|
||||||
|
*/
|
||||||
|
if (ldeconf->flags & F_LDPD_ORDERED_CONTROL) {
|
||||||
|
send_map = true;
|
||||||
|
fnh->flags &= ~F_FEC_NH_DEFER;
|
||||||
|
}
|
||||||
fnh->remote_label = map->label;
|
fnh->remote_label = map->label;
|
||||||
lde_send_change_klabel(fn, fnh);
|
lde_send_change_klabel(fn, fnh);
|
||||||
break;
|
break;
|
||||||
@ -558,6 +592,15 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln)
|
|||||||
* loop detection. LMp.28 - LMp.30 are unnecessary because we are
|
* loop detection. LMp.28 - LMp.30 are unnecessary because we are
|
||||||
* merging capable.
|
* merging capable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ordered Control: just received a labelmap for this fec from NH so
|
||||||
|
* need to send labelmap to all peers
|
||||||
|
* LMp.20 - LMp21 Execute procedure to send Label Mapping
|
||||||
|
*/
|
||||||
|
if (send_map && fn->local_label != NO_LABEL)
|
||||||
|
RB_FOREACH(ln, nbr_tree, &lde_nbrs)
|
||||||
|
lde_send_labelmapping(ln, fn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -757,6 +800,7 @@ lde_check_withdraw(struct map *map, struct lde_nbr *ln)
|
|||||||
struct fec_nh *fnh;
|
struct fec_nh *fnh;
|
||||||
struct lde_map *me;
|
struct lde_map *me;
|
||||||
struct l2vpn_pw *pw;
|
struct l2vpn_pw *pw;
|
||||||
|
struct lde_nbr *lnbr;
|
||||||
|
|
||||||
/* wildcard label withdraw */
|
/* wildcard label withdraw */
|
||||||
if (map->type == MAP_TYPE_WILDCARD ||
|
if (map->type == MAP_TYPE_WILDCARD ||
|
||||||
@ -803,6 +847,26 @@ lde_check_withdraw(struct map *map, struct lde_nbr *ln)
|
|||||||
if (me && (map->label == NO_LABEL || map->label == me->map.label))
|
if (me && (map->label == NO_LABEL || map->label == me->map.label))
|
||||||
/* LWd.4: remove record of previously received lbl mapping */
|
/* LWd.4: remove record of previously received lbl mapping */
|
||||||
lde_map_del(ln, me, 0);
|
lde_map_del(ln, me, 0);
|
||||||
|
|
||||||
|
/* Ordered Control: additional withdraw steps */
|
||||||
|
if (ldeconf->flags & F_LDPD_ORDERED_CONTROL) {
|
||||||
|
/* LWd.8: for each neighbor other that src of withdraw msg */
|
||||||
|
RB_FOREACH(lnbr, nbr_tree, &lde_nbrs) {
|
||||||
|
if (ln->peerid == lnbr->peerid)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* LWd.9: check if previously sent a label mapping */
|
||||||
|
me = (struct lde_map *)fec_find(&lnbr->sent_map,
|
||||||
|
&fn->fec);
|
||||||
|
/*
|
||||||
|
* LWd.10: does label sent to peer "map" to withdraw
|
||||||
|
* label
|
||||||
|
*/
|
||||||
|
if (me)
|
||||||
|
/* LWd.11: send label withdraw */
|
||||||
|
lde_send_labelwithdraw(lnbr, fn, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -813,6 +877,7 @@ lde_check_withdraw_wcard(struct map *map, struct lde_nbr *ln)
|
|||||||
struct fec_nh *fnh;
|
struct fec_nh *fnh;
|
||||||
struct lde_map *me;
|
struct lde_map *me;
|
||||||
struct l2vpn_pw *pw;
|
struct l2vpn_pw *pw;
|
||||||
|
struct lde_nbr *lnbr;
|
||||||
|
|
||||||
/* LWd.2: send label release */
|
/* LWd.2: send label release */
|
||||||
lde_send_labelrelease(ln, NULL, map, map->label);
|
lde_send_labelrelease(ln, NULL, map, map->label);
|
||||||
@ -859,6 +924,26 @@ lde_check_withdraw_wcard(struct map *map, struct lde_nbr *ln)
|
|||||||
* label mapping
|
* label mapping
|
||||||
*/
|
*/
|
||||||
lde_map_del(ln, me, 0);
|
lde_map_del(ln, me, 0);
|
||||||
|
|
||||||
|
/* Ordered Control: additional withdraw steps */
|
||||||
|
if (ldeconf->flags & F_LDPD_ORDERED_CONTROL) {
|
||||||
|
/* LWd.8: for each neighbor other that src of withdraw msg */
|
||||||
|
RB_FOREACH(lnbr, nbr_tree, &lde_nbrs) {
|
||||||
|
if (ln->peerid == lnbr->peerid)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* LWd.9: check if previously sent a label mapping */
|
||||||
|
me = (struct lde_map *)fec_find(&lnbr->sent_map,
|
||||||
|
&fn->fec);
|
||||||
|
/*
|
||||||
|
* LWd.10: does label sent to peer "map" to withdraw
|
||||||
|
* label
|
||||||
|
*/
|
||||||
|
if (me)
|
||||||
|
/* LWd.11: send label withdraw */
|
||||||
|
lde_send_labelwithdraw(lnbr, fn, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ int ldp_vty_label_expnull(struct vty *, const char *, const char *);
|
|||||||
int ldp_vty_label_accept(struct vty *, const char *, const char *, const char *);
|
int ldp_vty_label_accept(struct vty *, const char *, const char *, const char *);
|
||||||
int ldp_vty_ttl_security(struct vty *, const char *);
|
int ldp_vty_ttl_security(struct vty *, const char *);
|
||||||
int ldp_vty_router_id(struct vty *, const char *, struct in_addr);
|
int ldp_vty_router_id(struct vty *, const char *, struct in_addr);
|
||||||
|
int ldp_vty_ordered_control(struct vty *, const char *);
|
||||||
int ldp_vty_ds_cisco_interop(struct vty *, const char *);
|
int ldp_vty_ds_cisco_interop(struct vty *, const char *);
|
||||||
int ldp_vty_trans_pref_ipv4(struct vty *, const char *);
|
int ldp_vty_trans_pref_ipv4(struct vty *, const char *);
|
||||||
int ldp_vty_neighbor_password(struct vty *, const char *, struct in_addr, const char *);
|
int ldp_vty_neighbor_password(struct vty *, const char *, struct in_addr, const char *);
|
||||||
|
@ -221,6 +221,15 @@ DEFPY (ldp_router_id,
|
|||||||
return (ldp_vty_router_id(vty, no, address));
|
return (ldp_vty_router_id(vty, no, address));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFPY (ldp_ordered_control,
|
||||||
|
ldp_ordered_control_cmd,
|
||||||
|
"[no] ordered-control",
|
||||||
|
NO_STR
|
||||||
|
"Configure LDP ordered label distribution control mode\n")
|
||||||
|
{
|
||||||
|
return (ldp_vty_ordered_control(vty, no));
|
||||||
|
}
|
||||||
|
|
||||||
DEFPY (ldp_discovery_targeted_hello_accept,
|
DEFPY (ldp_discovery_targeted_hello_accept,
|
||||||
ldp_discovery_targeted_hello_accept_cmd,
|
ldp_discovery_targeted_hello_accept_cmd,
|
||||||
"[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>$from_acl]",
|
"[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>$from_acl]",
|
||||||
@ -807,6 +816,7 @@ ldp_vty_init (void)
|
|||||||
install_element(LDP_NODE, &ldp_neighbor_session_holdtime_cmd);
|
install_element(LDP_NODE, &ldp_neighbor_session_holdtime_cmd);
|
||||||
install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd);
|
install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd);
|
||||||
install_element(LDP_NODE, &ldp_router_id_cmd);
|
install_element(LDP_NODE, &ldp_router_id_cmd);
|
||||||
|
install_element(LDP_NODE, &ldp_ordered_control_cmd);
|
||||||
|
|
||||||
install_element(LDP_IPV4_NODE, &ldp_discovery_link_holdtime_cmd);
|
install_element(LDP_IPV4_NODE, &ldp_discovery_link_holdtime_cmd);
|
||||||
install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_holdtime_cmd);
|
install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_holdtime_cmd);
|
||||||
|
@ -278,6 +278,9 @@ ldp_config_write(struct vty *vty)
|
|||||||
if (ldpd_conf->flags & F_LDPD_DS_CISCO_INTEROP)
|
if (ldpd_conf->flags & F_LDPD_DS_CISCO_INTEROP)
|
||||||
vty_out (vty, " dual-stack cisco-interop\n");
|
vty_out (vty, " dual-stack cisco-interop\n");
|
||||||
|
|
||||||
|
if (ldpd_conf->flags & F_LDPD_ORDERED_CONTROL)
|
||||||
|
vty_out (vty, " ordered-control\n");
|
||||||
|
|
||||||
RB_FOREACH(nbrp, nbrp_head, &ldpd_conf->nbrp_tree) {
|
RB_FOREACH(nbrp, nbrp_head, &ldpd_conf->nbrp_tree) {
|
||||||
if (nbrp->flags & F_NBRP_KEEPALIVE)
|
if (nbrp->flags & F_NBRP_KEEPALIVE)
|
||||||
vty_out (vty, " neighbor %s session holdtime %u\n",
|
vty_out (vty, " neighbor %s session holdtime %u\n",
|
||||||
@ -996,6 +999,19 @@ ldp_vty_router_id(struct vty *vty, const char *negate, struct in_addr address)
|
|||||||
return (CMD_SUCCESS);
|
return (CMD_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ldp_vty_ordered_control(struct vty *vty, const char *negate)
|
||||||
|
{
|
||||||
|
if (negate)
|
||||||
|
vty_conf->flags &= ~F_LDPD_ORDERED_CONTROL;
|
||||||
|
else
|
||||||
|
vty_conf->flags |= F_LDPD_ORDERED_CONTROL;
|
||||||
|
|
||||||
|
ldp_config_apply(vty, vty_conf);
|
||||||
|
|
||||||
|
return (CMD_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ldp_vty_ds_cisco_interop(struct vty *vty, const char * negate)
|
ldp_vty_ds_cisco_interop(struct vty *vty, const char * negate)
|
||||||
{
|
{
|
||||||
|
@ -1285,6 +1285,14 @@ merge_global(struct ldpd_conf *conf, struct ldpd_conf *xconf)
|
|||||||
conf->rtr_id = xconf->rtr_id;
|
conf->rtr_id = xconf->rtr_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Configuration of ordered-control or independent-control
|
||||||
|
* requires resetting all neighborships.
|
||||||
|
*/
|
||||||
|
if ((conf->flags & F_LDPD_ORDERED_CONTROL) !=
|
||||||
|
(xconf->flags & F_LDPD_ORDERED_CONTROL))
|
||||||
|
ldpe_reset_nbrs(AF_UNSPEC);
|
||||||
|
|
||||||
conf->lhello_holdtime = xconf->lhello_holdtime;
|
conf->lhello_holdtime = xconf->lhello_holdtime;
|
||||||
conf->lhello_interval = xconf->lhello_interval;
|
conf->lhello_interval = xconf->lhello_interval;
|
||||||
conf->thello_holdtime = xconf->thello_holdtime;
|
conf->thello_holdtime = xconf->thello_holdtime;
|
||||||
|
@ -511,6 +511,8 @@ DECLARE_QOBJ_TYPE(ldpd_conf)
|
|||||||
#define F_LDPD_NO_FIB_UPDATE 0x0001
|
#define F_LDPD_NO_FIB_UPDATE 0x0001
|
||||||
#define F_LDPD_DS_CISCO_INTEROP 0x0002
|
#define F_LDPD_DS_CISCO_INTEROP 0x0002
|
||||||
#define F_LDPD_ENABLED 0x0004
|
#define F_LDPD_ENABLED 0x0004
|
||||||
|
#define F_LDPD_ORDERED_CONTROL 0x0008
|
||||||
|
|
||||||
|
|
||||||
struct ldpd_af_global {
|
struct ldpd_af_global {
|
||||||
struct thread *disc_ev;
|
struct thread *disc_ev;
|
||||||
|
25
tests/topotests/ldp-oc-acl-topo1/r1/ldpd.conf
Normal file
25
tests/topotests/ldp-oc-acl-topo1/r1/ldpd.conf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
hostname r1
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 1.1.1.1
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 1.1.1.1
|
||||||
|
label local allocate host-routes
|
||||||
|
!
|
||||||
|
interface r1-eth0
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
7
tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf
Normal file
7
tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hostname r1
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 1.1.1.1
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"2.2.2.2":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DR",
|
||||||
|
"address":"10.0.1.2",
|
||||||
|
"ifaceName":"r1-eth0:10.0.1.1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
171
tests/topotests/ldp-oc-acl-topo1/r1/show_ip_route.ref
Normal file
171
tests/topotests/ldp-oc-acl-topo1/r1/show_ip_route.ref
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
55
tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_binding.ref
Normal file
55
tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_binding.ref
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"localLabel":"-",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"localLabel":"-",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"localLabel":"-",
|
||||||
|
"inUse":1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_discovery.ref
Normal file
11
tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_discovery.ref
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"adjacencies":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r1-eth0",
|
||||||
|
"helloHoldtime":15
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_neighbor.ref
Normal file
10
tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_neighbor.ref
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"neighbors":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"2.2.2.2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
tests/topotests/ldp-oc-acl-topo1/r1/zebra.conf
Normal file
17
tests/topotests/ldp-oc-acl-topo1/r1/zebra.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r1
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 1.1.1.1/32
|
||||||
|
!
|
||||||
|
interface r1-eth0
|
||||||
|
description to sw0
|
||||||
|
ip address 10.0.1.1/24
|
||||||
|
ip address 123.0.1.1/24
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
28
tests/topotests/ldp-oc-acl-topo1/r2/ldpd.conf
Normal file
28
tests/topotests/ldp-oc-acl-topo1/r2/ldpd.conf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
hostname r2
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 2.2.2.2
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 2.2.2.2
|
||||||
|
!
|
||||||
|
interface r2-eth0
|
||||||
|
!
|
||||||
|
interface r2-eth1
|
||||||
|
!
|
||||||
|
interface r2-eth2
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
7
tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf
Normal file
7
tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hostname r2
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 2.2.2.2
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"1.1.1.1":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/Backup",
|
||||||
|
"address":"10.0.1.1",
|
||||||
|
"ifaceName":"r2-eth0:10.0.1.2",
|
||||||
|
"retransmitCounter":0,
|
||||||
|
"requestCounter":0,
|
||||||
|
"dbSummaryCounter":0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/Backup",
|
||||||
|
"address":"10.0.2.3",
|
||||||
|
"ifaceName":"r2-eth1:10.0.2.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DR",
|
||||||
|
"address":"10.0.2.4",
|
||||||
|
"ifaceName":"r2-eth1:10.0.2.2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
209
tests/topotests/ldp-oc-acl-topo1/r2/show_ip_route.ref
Normal file
209
tests/topotests/ldp-oc-acl-topo1/r2/show_ip_route.ref
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.1",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":0,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.4",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.1",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
63
tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_binding.ref
Normal file
63
tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_binding.ref
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_discovery.ref
Normal file
18
tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_discovery.ref
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"adjacencies":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r2-eth0",
|
||||||
|
"helloHoldtime":15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r2-eth1",
|
||||||
|
"helloHoldtime":15
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
16
tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_neighbor.ref
Normal file
16
tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_neighbor.ref
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"neighbors":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"1.1.1.1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"3.3.3.3"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
27
tests/topotests/ldp-oc-acl-topo1/r2/zebra.conf
Normal file
27
tests/topotests/ldp-oc-acl-topo1/r2/zebra.conf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r2
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 2.2.2.2/32
|
||||||
|
!
|
||||||
|
interface r2-eth0
|
||||||
|
description to sw0
|
||||||
|
ip address 10.0.1.2/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
interface r2-eth1
|
||||||
|
description to sw1
|
||||||
|
ip address 10.0.2.2/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
interface r2-eths2
|
||||||
|
description to sw2
|
||||||
|
ip address 10.0.3.2/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
24
tests/topotests/ldp-oc-acl-topo1/r3/ldpd.conf
Normal file
24
tests/topotests/ldp-oc-acl-topo1/r3/ldpd.conf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
hostname r3
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 3.3.3.3
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 3.3.3.3
|
||||||
|
!
|
||||||
|
interface r3-eth0
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
8
tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf
Normal file
8
tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
hostname r3
|
||||||
|
password 1
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 3.3.3.3
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"2.2.2.2":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DROther",
|
||||||
|
"address":"10.0.2.2",
|
||||||
|
"ifaceName":"r3-eth0:10.0.2.3"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DR",
|
||||||
|
"address":"10.0.2.4",
|
||||||
|
"ifaceName":"r3-eth0:10.0.2.3"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
209
tests/topotests/ldp-oc-acl-topo1/r3/show_ip_route.ref
Normal file
209
tests/topotests/ldp-oc-acl-topo1/r3/show_ip_route.ref
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":0,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.4",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r3-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r3-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":30,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
62
tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_binding.ref
Normal file
62
tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_binding.ref
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_discovery.ref
Normal file
11
tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_discovery.ref
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"adjacencies":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r3-eth0",
|
||||||
|
"helloHoldtime":15
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_neighbor.ref
Normal file
10
tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_neighbor.ref
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"neighbors":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"2.2.2.2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
22
tests/topotests/ldp-oc-acl-topo1/r3/zebra.conf
Normal file
22
tests/topotests/ldp-oc-acl-topo1/r3/zebra.conf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r3
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 3.3.3.3/32
|
||||||
|
!
|
||||||
|
interface r3-eth0
|
||||||
|
description to sw1
|
||||||
|
ip address 10.0.2.3/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
interface r3-eth1
|
||||||
|
description to sw2
|
||||||
|
ip address 10.0.3.3/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
24
tests/topotests/ldp-oc-acl-topo1/r4/ldpd.conf
Normal file
24
tests/topotests/ldp-oc-acl-topo1/r4/ldpd.conf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
hostname r4
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 4.4.4.4
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 4.4.4.4
|
||||||
|
!
|
||||||
|
!interface r4-eth0
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
7
tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf
Normal file
7
tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hostname r4
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 4.4.4.4
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"2.2.2.2":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DROther",
|
||||||
|
"address":"10.0.2.2",
|
||||||
|
"ifaceName":"r4-eth0:10.0.2.4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/Backup",
|
||||||
|
"address":"10.0.2.3",
|
||||||
|
"ifaceName":"r4-eth0:10.0.2.4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
196
tests/topotests/ldp-oc-acl-topo1/r4/show_ip_route.ref
Normal file
196
tests/topotests/ldp-oc-acl-topo1/r4/show_ip_route.ref
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":0,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":30,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
68
tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_binding.ref
Normal file
68
tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_binding.ref
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
17
tests/topotests/ldp-oc-acl-topo1/r4/zebra.conf
Normal file
17
tests/topotests/ldp-oc-acl-topo1/r4/zebra.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r4
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 4.4.4.4/32
|
||||||
|
!
|
||||||
|
interface r4-eth0
|
||||||
|
description to sw1
|
||||||
|
ip address 10.0.2.4/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
76
tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.dot
Normal file
76
tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.dot
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
## Color coding:
|
||||||
|
#########################
|
||||||
|
## Main FRR: #f08080 red
|
||||||
|
## Switches: #d0e0d0 gray
|
||||||
|
## RIP: #19e3d9 Cyan
|
||||||
|
## RIPng: #fcb314 dark yellow
|
||||||
|
## OSPFv2: #32b835 Green
|
||||||
|
## OSPFv3: #19e3d9 Cyan
|
||||||
|
## ISIS IPv4 #fcb314 dark yellow
|
||||||
|
## ISIS IPv6 #9a81ec purple
|
||||||
|
## BGP IPv4 #eee3d3 beige
|
||||||
|
## BGP IPv6 #fdff00 yellow
|
||||||
|
##### Colors (see http://www.color-hex.com/)
|
||||||
|
|
||||||
|
graph template {
|
||||||
|
label="Test Topology - LDP-OC 1";
|
||||||
|
|
||||||
|
# Routers
|
||||||
|
r1 [
|
||||||
|
shape=doubleoctagon,
|
||||||
|
label="r1",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
r2 [
|
||||||
|
shape=doubleoctagon
|
||||||
|
label="r2",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
r3 [
|
||||||
|
shape=doubleoctagon
|
||||||
|
label="r3",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
r4 [
|
||||||
|
shape=doubleoctagon
|
||||||
|
label="r4",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
# Switches
|
||||||
|
s0 [
|
||||||
|
shape=oval,
|
||||||
|
label="10.0.1.0/24",
|
||||||
|
fillcolor="#d0e0d0",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
s1 [
|
||||||
|
shape=oval,
|
||||||
|
label="10.0.2.0/24",
|
||||||
|
fillcolor="#d0e0d0",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
s2 [
|
||||||
|
shape=oval,
|
||||||
|
label="10.0.3.0/24",
|
||||||
|
fillcolor="#d0e0d0",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
|
||||||
|
# Connections
|
||||||
|
|
||||||
|
r1 -- s0 [label="eth0"];
|
||||||
|
r2 -- s0 [label="eth0"];
|
||||||
|
|
||||||
|
r2 -- s1 [label="eth1"];
|
||||||
|
r3 -- s1 [label="eth0"];
|
||||||
|
r4 -- s1 [label="eth0"];
|
||||||
|
|
||||||
|
r2 -- s2 [label="eth2"];
|
||||||
|
r3 -- s2 [label="eth1"];
|
||||||
|
}
|
227
tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.py
Executable file
227
tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.py
Executable file
@ -0,0 +1,227 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
#
|
||||||
|
# test_ldp_oc_acl_topo1.py
|
||||||
|
# Part of NetDEF Topology Tests
|
||||||
|
#
|
||||||
|
# Copyright (c) 2020 by Volta Networks
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software
|
||||||
|
# for any purpose with or without fee is hereby granted, provided
|
||||||
|
# that the above copyright notice and this permission notice appear
|
||||||
|
# in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
|
||||||
|
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
|
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
# OF THIS SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
test_ldp_oc_acl_topo1.py: Simple FRR/Quagga LDP Test
|
||||||
|
|
||||||
|
+---------+
|
||||||
|
| r1 |
|
||||||
|
| 1.1.1.1 |
|
||||||
|
+----+----+
|
||||||
|
| .1 r1-eth0
|
||||||
|
|
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
~~ sw0 ~~
|
||||||
|
~~ 10.0.1.0/24 ~~
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|10.0.1.0/24
|
||||||
|
|
|
||||||
|
| .2 r2-eth0
|
||||||
|
+----+----+
|
||||||
|
| r2 |
|
||||||
|
| 2.2.2.2 |
|
||||||
|
+--+---+--+
|
||||||
|
r2-eth2 .2 | | .2 r2-eth1
|
||||||
|
______/ \______
|
||||||
|
/ \
|
||||||
|
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
|
||||||
|
~~ sw2 ~~ ~~ sw1 ~~
|
||||||
|
~~ 10.0.3.0/24 ~~ ~~ 10.0.2.0/24 ~~
|
||||||
|
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
|
||||||
|
| / |
|
||||||
|
\ _________/ |
|
||||||
|
\ / \
|
||||||
|
r3-eth1 .3 | | .3 r3-eth0 | .4 r4-eth0
|
||||||
|
+----+--+---+ +----+----+
|
||||||
|
| r3 | | r4 |
|
||||||
|
| 3.3.3.3 | | 4.4.4.4 |
|
||||||
|
+-----------+ +---------+
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import pytest
|
||||||
|
import json
|
||||||
|
from time import sleep
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
# Save the Current Working Directory to find configuration files.
|
||||||
|
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
sys.path.append(os.path.join(CWD, '../'))
|
||||||
|
|
||||||
|
# pylint: disable=C0413
|
||||||
|
# Import topogen and topotest helpers
|
||||||
|
from lib import topotest
|
||||||
|
from lib.topogen import Topogen, TopoRouter, get_topogen
|
||||||
|
from lib.topolog import logger
|
||||||
|
|
||||||
|
# Required to instantiate the topology builder class.
|
||||||
|
from mininet.topo import Topo
|
||||||
|
|
||||||
|
class TemplateTopo(Topo):
|
||||||
|
"Test topology builder"
|
||||||
|
def build(self, *_args, **_opts):
|
||||||
|
"Build function"
|
||||||
|
tgen = get_topogen(self)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Define FRR Routers
|
||||||
|
#
|
||||||
|
for router in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
tgen.add_router(router)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Define connections
|
||||||
|
#
|
||||||
|
switch = tgen.add_switch('s0')
|
||||||
|
switch.add_link(tgen.gears['r1'])
|
||||||
|
switch.add_link(tgen.gears['r2'])
|
||||||
|
|
||||||
|
switch = tgen.add_switch('s1')
|
||||||
|
switch.add_link(tgen.gears['r2'])
|
||||||
|
switch.add_link(tgen.gears['r3'])
|
||||||
|
switch.add_link(tgen.gears['r4'])
|
||||||
|
|
||||||
|
switch = tgen.add_switch('s2')
|
||||||
|
switch.add_link(tgen.gears['r2'])
|
||||||
|
switch.add_link(tgen.gears['r3'])
|
||||||
|
|
||||||
|
def setup_module(mod):
|
||||||
|
"Sets up the pytest environment"
|
||||||
|
tgen = Topogen(TemplateTopo, mod.__name__)
|
||||||
|
tgen.start_topology()
|
||||||
|
|
||||||
|
router_list = tgen.routers()
|
||||||
|
|
||||||
|
# For all registered routers, load the zebra configuration file
|
||||||
|
for rname, router in router_list.iteritems():
|
||||||
|
router.load_config(
|
||||||
|
TopoRouter.RD_ZEBRA,
|
||||||
|
os.path.join(CWD, '{}/zebra.conf'.format(rname))
|
||||||
|
)
|
||||||
|
# Don't start ospfd and ldpd in the CE nodes
|
||||||
|
if router.name[0] == 'r':
|
||||||
|
router.load_config(
|
||||||
|
TopoRouter.RD_OSPF,
|
||||||
|
os.path.join(CWD, '{}/ospfd.conf'.format(rname))
|
||||||
|
)
|
||||||
|
router.load_config(
|
||||||
|
TopoRouter.RD_LDP,
|
||||||
|
os.path.join(CWD, '{}/ldpd.conf'.format(rname))
|
||||||
|
)
|
||||||
|
|
||||||
|
tgen.start_router()
|
||||||
|
|
||||||
|
def teardown_module(mod):
|
||||||
|
"Teardown the pytest environment"
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# This function tears down the whole topology.
|
||||||
|
tgen.stop_topology()
|
||||||
|
|
||||||
|
|
||||||
|
def router_compare_json_output(rname, command, reference):
|
||||||
|
"Compare router JSON output"
|
||||||
|
|
||||||
|
logger.info('Comparing router "%s" "%s" output', rname, command)
|
||||||
|
|
||||||
|
tgen = get_topogen()
|
||||||
|
filename = '{}/{}/{}'.format(CWD, rname, reference)
|
||||||
|
expected = json.loads(open(filename).read())
|
||||||
|
|
||||||
|
# Run test function until we get an result. Wait at most 80 seconds.
|
||||||
|
test_func = partial(topotest.router_json_cmp,
|
||||||
|
tgen.gears[rname], command, expected)
|
||||||
|
_, diff = topotest.run_and_expect(test_func, None, count=160, wait=0.5)
|
||||||
|
|
||||||
|
assertmsg = '"{}" JSON output mismatches the expected result'.format(rname)
|
||||||
|
assert diff is None, assertmsg
|
||||||
|
|
||||||
|
def test_ospf_convergence():
|
||||||
|
logger.info("Test: check OSPF adjacencies")
|
||||||
|
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show ip ospf neighbor json", "show_ip_ospf_neighbor.json")
|
||||||
|
|
||||||
|
def test_rib():
|
||||||
|
logger.info("Test: verify RIB")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show ip route json", "show_ip_route.ref")
|
||||||
|
|
||||||
|
def test_ldp_adjacencies():
|
||||||
|
logger.info("Test: verify LDP adjacencies")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show mpls ldp discovery json", "show_ldp_discovery.ref")
|
||||||
|
|
||||||
|
def test_ldp_neighbors():
|
||||||
|
logger.info("Test: verify LDP neighbors")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show mpls ldp neighbor json", "show_ldp_neighbor.ref")
|
||||||
|
|
||||||
|
def test_ldp_bindings():
|
||||||
|
logger.info("Test: verify LDP bindings")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show mpls ldp binding json", "show_ldp_binding.ref")
|
||||||
|
|
||||||
|
# Memory leak test template
|
||||||
|
def test_memory_leak():
|
||||||
|
"Run the memory leak test and report results."
|
||||||
|
tgen = get_topogen()
|
||||||
|
if not tgen.is_memleak_enabled():
|
||||||
|
pytest.skip('Memory leak test/report is disabled')
|
||||||
|
|
||||||
|
tgen.report_memory_leaks()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = ["-s"] + sys.argv[1:]
|
||||||
|
sys.exit(pytest.main(args))
|
24
tests/topotests/ldp-oc-topo1/r1/ldpd.conf
Normal file
24
tests/topotests/ldp-oc-topo1/r1/ldpd.conf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
hostname r1
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 1.1.1.1
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 1.1.1.1
|
||||||
|
!
|
||||||
|
interface r1-eth0
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
7
tests/topotests/ldp-oc-topo1/r1/ospfd.conf
Normal file
7
tests/topotests/ldp-oc-topo1/r1/ospfd.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hostname r1
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 1.1.1.1
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
12
tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json
Normal file
12
tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"2.2.2.2":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DR",
|
||||||
|
"address":"10.0.1.2",
|
||||||
|
"ifaceName":"r1-eth0:10.0.1.1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
171
tests/topotests/ldp-oc-topo1/r1/show_ip_route.ref
Normal file
171
tests/topotests/ldp-oc-topo1/r1/show_ip_route.ref
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r1-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
61
tests/topotests/ldp-oc-topo1/r1/show_ldp_binding.ref
Normal file
61
tests/topotests/ldp-oc-topo1/r1/show_ldp_binding.ref
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
tests/topotests/ldp-oc-topo1/r1/show_ldp_discovery.ref
Normal file
11
tests/topotests/ldp-oc-topo1/r1/show_ldp_discovery.ref
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"adjacencies":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r1-eth0",
|
||||||
|
"helloHoldtime":15
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
tests/topotests/ldp-oc-topo1/r1/show_ldp_neighbor.ref
Normal file
10
tests/topotests/ldp-oc-topo1/r1/show_ldp_neighbor.ref
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"neighbors":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"2.2.2.2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
tests/topotests/ldp-oc-topo1/r1/zebra.conf
Normal file
17
tests/topotests/ldp-oc-topo1/r1/zebra.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r1
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 1.1.1.1/32
|
||||||
|
!
|
||||||
|
interface r1-eth0
|
||||||
|
description to sw0
|
||||||
|
ip address 10.0.1.1/24
|
||||||
|
ip address 123.0.1.1/24
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
28
tests/topotests/ldp-oc-topo1/r2/ldpd.conf
Normal file
28
tests/topotests/ldp-oc-topo1/r2/ldpd.conf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
hostname r2
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 2.2.2.2
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 2.2.2.2
|
||||||
|
!
|
||||||
|
interface r2-eth0
|
||||||
|
!
|
||||||
|
interface r2-eth1
|
||||||
|
!
|
||||||
|
interface r2-eth2
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
7
tests/topotests/ldp-oc-topo1/r2/ospfd.conf
Normal file
7
tests/topotests/ldp-oc-topo1/r2/ospfd.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hostname r2
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 2.2.2.2
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
31
tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json
Normal file
31
tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"1.1.1.1":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/Backup",
|
||||||
|
"address":"10.0.1.1",
|
||||||
|
"ifaceName":"r2-eth0:10.0.1.2",
|
||||||
|
"retransmitCounter":0,
|
||||||
|
"requestCounter":0,
|
||||||
|
"dbSummaryCounter":0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/Backup",
|
||||||
|
"address":"10.0.2.3",
|
||||||
|
"ifaceName":"r2-eth1:10.0.2.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DR",
|
||||||
|
"address":"10.0.2.4",
|
||||||
|
"ifaceName":"r2-eth1:10.0.2.2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
209
tests/topotests/ldp-oc-topo1/r2/show_ip_route.ref
Normal file
209
tests/topotests/ldp-oc-topo1/r2/show_ip_route.ref
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.1",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":0,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.4",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r2-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.1.1",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r2-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
63
tests/topotests/ldp-oc-topo1/r2/show_ldp_binding.ref
Normal file
63
tests/topotests/ldp-oc-topo1/r2/show_ldp_binding.ref
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
tests/topotests/ldp-oc-topo1/r2/show_ldp_discovery.ref
Normal file
18
tests/topotests/ldp-oc-topo1/r2/show_ldp_discovery.ref
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"adjacencies":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r2-eth0",
|
||||||
|
"helloHoldtime":15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r2-eth1",
|
||||||
|
"helloHoldtime":15
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
16
tests/topotests/ldp-oc-topo1/r2/show_ldp_neighbor.ref
Normal file
16
tests/topotests/ldp-oc-topo1/r2/show_ldp_neighbor.ref
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"neighbors":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"1.1.1.1",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"1.1.1.1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"3.3.3.3",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"3.3.3.3"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
27
tests/topotests/ldp-oc-topo1/r2/zebra.conf
Normal file
27
tests/topotests/ldp-oc-topo1/r2/zebra.conf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r2
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 2.2.2.2/32
|
||||||
|
!
|
||||||
|
interface r2-eth0
|
||||||
|
description to sw0
|
||||||
|
ip address 10.0.1.2/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
interface r2-eth1
|
||||||
|
description to sw1
|
||||||
|
ip address 10.0.2.2/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
interface r2-eths2
|
||||||
|
description to sw2
|
||||||
|
ip address 10.0.3.2/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
24
tests/topotests/ldp-oc-topo1/r3/ldpd.conf
Normal file
24
tests/topotests/ldp-oc-topo1/r3/ldpd.conf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
hostname r3
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 3.3.3.3
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 3.3.3.3
|
||||||
|
!
|
||||||
|
interface r3-eth0
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
8
tests/topotests/ldp-oc-topo1/r3/ospfd.conf
Normal file
8
tests/topotests/ldp-oc-topo1/r3/ospfd.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
hostname r3
|
||||||
|
password 1
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 3.3.3.3
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
20
tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json
Normal file
20
tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"2.2.2.2":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DROther",
|
||||||
|
"address":"10.0.2.2",
|
||||||
|
"ifaceName":"r3-eth0:10.0.2.3"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DR",
|
||||||
|
"address":"10.0.2.4",
|
||||||
|
"ifaceName":"r3-eth0:10.0.2.3"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
209
tests/topotests/ldp-oc-topo1/r3/show_ip_route.ref
Normal file
209
tests/topotests/ldp-oc-topo1/r3/show_ip_route.ref
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":0,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.4",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r3-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":3,
|
||||||
|
"interfaceName":"r3-eth1",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":30,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r3-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
61
tests/topotests/ldp-oc-topo1/r3/show_ldp_binding.ref
Normal file
61
tests/topotests/ldp-oc-topo1/r3/show_ldp_binding.ref
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"imp-null",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"inUse":1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
tests/topotests/ldp-oc-topo1/r3/show_ldp_discovery.ref
Normal file
11
tests/topotests/ldp-oc-topo1/r3/show_ldp_discovery.ref
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"adjacencies":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"type":"link",
|
||||||
|
"interface":"r3-eth0",
|
||||||
|
"helloHoldtime":15
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
tests/topotests/ldp-oc-topo1/r3/show_ldp_neighbor.ref
Normal file
10
tests/topotests/ldp-oc-topo1/r3/show_ldp_neighbor.ref
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"neighbors":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"neighborId":"2.2.2.2",
|
||||||
|
"state":"OPERATIONAL",
|
||||||
|
"transportAddress":"2.2.2.2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
22
tests/topotests/ldp-oc-topo1/r3/zebra.conf
Normal file
22
tests/topotests/ldp-oc-topo1/r3/zebra.conf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r3
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 3.3.3.3/32
|
||||||
|
!
|
||||||
|
interface r3-eth0
|
||||||
|
description to sw1
|
||||||
|
ip address 10.0.2.3/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
interface r3-eth1
|
||||||
|
description to sw2
|
||||||
|
ip address 10.0.3.3/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
24
tests/topotests/ldp-oc-topo1/r4/ldpd.conf
Normal file
24
tests/topotests/ldp-oc-topo1/r4/ldpd.conf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
hostname r4
|
||||||
|
log file ldpd.log
|
||||||
|
!
|
||||||
|
debug mpls ldp zebra
|
||||||
|
debug mpls ldp event
|
||||||
|
debug mpls ldp errors
|
||||||
|
debug mpls ldp messages recv
|
||||||
|
debug mpls ldp messages sent
|
||||||
|
debug mpls ldp discovery hello recv
|
||||||
|
debug mpls ldp discovery hello sent
|
||||||
|
!
|
||||||
|
mpls ldp
|
||||||
|
router-id 4.4.4.4
|
||||||
|
ordered-control
|
||||||
|
!
|
||||||
|
address-family ipv4
|
||||||
|
discovery transport-address 4.4.4.4
|
||||||
|
!
|
||||||
|
!interface r4-eth0
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
7
tests/topotests/ldp-oc-topo1/r4/ospfd.conf
Normal file
7
tests/topotests/ldp-oc-topo1/r4/ospfd.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
hostname r4
|
||||||
|
log file ospfd.log
|
||||||
|
!
|
||||||
|
router ospf
|
||||||
|
router-id 4.4.4.4
|
||||||
|
network 0.0.0.0/0 area 0
|
||||||
|
!
|
21
tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json
Normal file
21
tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
"neighbors":{
|
||||||
|
"2.2.2.2":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/DROther",
|
||||||
|
"address":"10.0.2.2",
|
||||||
|
"ifaceName":"r4-eth0:10.0.2.4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3":[
|
||||||
|
{
|
||||||
|
"priority":1,
|
||||||
|
"state":"Full\/Backup",
|
||||||
|
"address":"10.0.2.3",
|
||||||
|
"ifaceName":"r4-eth0:10.0.2.4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
196
tests/topotests/ldp-oc-topo1/r4/show_ip_route.ref
Normal file
196
tests/topotests/ldp-oc-topo1/r4/show_ip_route.ref
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
{
|
||||||
|
"1.1.1.1/32":[
|
||||||
|
{
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"2.2.2.2/32":[
|
||||||
|
{
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"3.3.3.3/32":[
|
||||||
|
{
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"4.4.4.4/32":[
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":0,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":1,
|
||||||
|
"interfaceName":"lo",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.2.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"distance":110,
|
||||||
|
"metric":10,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"prefix":"10.0.2.0\/24",
|
||||||
|
"protocol":"connected",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":0,
|
||||||
|
"metric":0,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"directlyConnected":true,
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"10.0.3.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"10.0.3.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":20,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.3",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"123.0.1.0\/24":[
|
||||||
|
{
|
||||||
|
"prefix":"123.0.1.0\/24",
|
||||||
|
"protocol":"ospf",
|
||||||
|
"selected":true,
|
||||||
|
"destSelected":true,
|
||||||
|
"distance":110,
|
||||||
|
"metric":30,
|
||||||
|
"installed":true,
|
||||||
|
"nexthops":[
|
||||||
|
{
|
||||||
|
"fib":true,
|
||||||
|
"ip":"10.0.2.2",
|
||||||
|
"afi":"ipv4",
|
||||||
|
"interfaceIndex":2,
|
||||||
|
"interfaceName":"r4-eth0",
|
||||||
|
"active":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
68
tests/topotests/ldp-oc-topo1/r4/show_ldp_binding.ref
Normal file
68
tests/topotests/ldp-oc-topo1/r4/show_ldp_binding.ref
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"bindings":[
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"1.1.1.1/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"2.2.2.2/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"3.3.3.3/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"4.4.4.4/32",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.2.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"10.0.3.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"addressFamily":"ipv4",
|
||||||
|
"prefix":"123.0.1.0/24",
|
||||||
|
"neighborId":"0.0.0.0",
|
||||||
|
"localLabel":"imp-null",
|
||||||
|
"remoteLabel":"-",
|
||||||
|
"inUse":0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
2
tests/topotests/ldp-oc-topo1/r4/show_ldp_discovery.ref
Normal file
2
tests/topotests/ldp-oc-topo1/r4/show_ldp_discovery.ref
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
2
tests/topotests/ldp-oc-topo1/r4/show_ldp_neighbor.ref
Normal file
2
tests/topotests/ldp-oc-topo1/r4/show_ldp_neighbor.ref
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
17
tests/topotests/ldp-oc-topo1/r4/zebra.conf
Normal file
17
tests/topotests/ldp-oc-topo1/r4/zebra.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
log file zebra.log
|
||||||
|
!
|
||||||
|
hostname r4
|
||||||
|
!
|
||||||
|
interface lo
|
||||||
|
ip address 4.4.4.4/32
|
||||||
|
!
|
||||||
|
interface r4-eth0
|
||||||
|
description to sw1
|
||||||
|
ip address 10.0.2.4/24
|
||||||
|
! no link-detect
|
||||||
|
!
|
||||||
|
ip forwarding
|
||||||
|
!
|
||||||
|
!
|
||||||
|
line vty
|
||||||
|
!
|
76
tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.dot
Normal file
76
tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.dot
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
## Color coding:
|
||||||
|
#########################
|
||||||
|
## Main FRR: #f08080 red
|
||||||
|
## Switches: #d0e0d0 gray
|
||||||
|
## RIP: #19e3d9 Cyan
|
||||||
|
## RIPng: #fcb314 dark yellow
|
||||||
|
## OSPFv2: #32b835 Green
|
||||||
|
## OSPFv3: #19e3d9 Cyan
|
||||||
|
## ISIS IPv4 #fcb314 dark yellow
|
||||||
|
## ISIS IPv6 #9a81ec purple
|
||||||
|
## BGP IPv4 #eee3d3 beige
|
||||||
|
## BGP IPv6 #fdff00 yellow
|
||||||
|
##### Colors (see http://www.color-hex.com/)
|
||||||
|
|
||||||
|
graph template {
|
||||||
|
label="Test Topology - LDP-OC 1";
|
||||||
|
|
||||||
|
# Routers
|
||||||
|
r1 [
|
||||||
|
shape=doubleoctagon,
|
||||||
|
label="r1",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
r2 [
|
||||||
|
shape=doubleoctagon
|
||||||
|
label="r2",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
r3 [
|
||||||
|
shape=doubleoctagon
|
||||||
|
label="r3",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
r4 [
|
||||||
|
shape=doubleoctagon
|
||||||
|
label="r4",
|
||||||
|
fillcolor="#f08080",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
# Switches
|
||||||
|
s0 [
|
||||||
|
shape=oval,
|
||||||
|
label="10.0.1.0/24",
|
||||||
|
fillcolor="#d0e0d0",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
s1 [
|
||||||
|
shape=oval,
|
||||||
|
label="10.0.2.0/24",
|
||||||
|
fillcolor="#d0e0d0",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
s2 [
|
||||||
|
shape=oval,
|
||||||
|
label="10.0.3.0/24",
|
||||||
|
fillcolor="#d0e0d0",
|
||||||
|
style=filled,
|
||||||
|
];
|
||||||
|
|
||||||
|
# Connections
|
||||||
|
|
||||||
|
r1 -- s0 [label="eth0"];
|
||||||
|
r2 -- s0 [label="eth0"];
|
||||||
|
|
||||||
|
r2 -- s1 [label="eth1"];
|
||||||
|
r3 -- s1 [label="eth0"];
|
||||||
|
r4 -- s1 [label="eth0"];
|
||||||
|
|
||||||
|
r2 -- s2 [label="eth2"];
|
||||||
|
r3 -- s2 [label="eth1"];
|
||||||
|
}
|
227
tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.py
Executable file
227
tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.py
Executable file
@ -0,0 +1,227 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
#
|
||||||
|
# test_ldp_oc_topo1.py
|
||||||
|
# Part of NetDEF Topology Tests
|
||||||
|
#
|
||||||
|
# Copyright (c) 2020 by by Volta Networks
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software
|
||||||
|
# for any purpose with or without fee is hereby granted, provided
|
||||||
|
# that the above copyright notice and this permission notice appear
|
||||||
|
# in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
|
||||||
|
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||||
|
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||||
|
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
# OF THIS SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
test_ldp_oc_topo1.py: Simple FRR/Quagga LDP Test
|
||||||
|
|
||||||
|
+---------+
|
||||||
|
| r1 |
|
||||||
|
| 1.1.1.1 |
|
||||||
|
+----+----+
|
||||||
|
| .1 r1-eth0
|
||||||
|
|
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
~~ sw0 ~~
|
||||||
|
~~ 10.0.1.0/24 ~~
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|10.0.1.0/24
|
||||||
|
|
|
||||||
|
| .2 r2-eth0
|
||||||
|
+----+----+
|
||||||
|
| r2 |
|
||||||
|
| 2.2.2.2 |
|
||||||
|
+--+---+--+
|
||||||
|
r2-eth2 .2 | | .2 r2-eth1
|
||||||
|
______/ \______
|
||||||
|
/ \
|
||||||
|
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
|
||||||
|
~~ sw2 ~~ ~~ sw1 ~~
|
||||||
|
~~ 10.0.3.0/24 ~~ ~~ 10.0.2.0/24 ~~
|
||||||
|
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
|
||||||
|
| / |
|
||||||
|
\ _________/ |
|
||||||
|
\ / \
|
||||||
|
r3-eth1 .3 | | .3 r3-eth0 | .4 r4-eth0
|
||||||
|
+----+--+---+ +----+----+
|
||||||
|
| r3 | | r4 |
|
||||||
|
| 3.3.3.3 | | 4.4.4.4 |
|
||||||
|
+-----------+ +---------+
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import pytest
|
||||||
|
import json
|
||||||
|
from time import sleep
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
# Save the Current Working Directory to find configuration files.
|
||||||
|
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
sys.path.append(os.path.join(CWD, '../'))
|
||||||
|
|
||||||
|
# pylint: disable=C0413
|
||||||
|
# Import topogen and topotest helpers
|
||||||
|
from lib import topotest
|
||||||
|
from lib.topogen import Topogen, TopoRouter, get_topogen
|
||||||
|
from lib.topolog import logger
|
||||||
|
|
||||||
|
# Required to instantiate the topology builder class.
|
||||||
|
from mininet.topo import Topo
|
||||||
|
|
||||||
|
class TemplateTopo(Topo):
|
||||||
|
"Test topology builder"
|
||||||
|
def build(self, *_args, **_opts):
|
||||||
|
"Build function"
|
||||||
|
tgen = get_topogen(self)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Define FRR Routers
|
||||||
|
#
|
||||||
|
for router in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
tgen.add_router(router)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Define connections
|
||||||
|
#
|
||||||
|
switch = tgen.add_switch('s0')
|
||||||
|
switch.add_link(tgen.gears['r1'])
|
||||||
|
switch.add_link(tgen.gears['r2'])
|
||||||
|
|
||||||
|
switch = tgen.add_switch('s1')
|
||||||
|
switch.add_link(tgen.gears['r2'])
|
||||||
|
switch.add_link(tgen.gears['r3'])
|
||||||
|
switch.add_link(tgen.gears['r4'])
|
||||||
|
|
||||||
|
switch = tgen.add_switch('s2')
|
||||||
|
switch.add_link(tgen.gears['r2'])
|
||||||
|
switch.add_link(tgen.gears['r3'])
|
||||||
|
|
||||||
|
def setup_module(mod):
|
||||||
|
"Sets up the pytest environment"
|
||||||
|
tgen = Topogen(TemplateTopo, mod.__name__)
|
||||||
|
tgen.start_topology()
|
||||||
|
|
||||||
|
router_list = tgen.routers()
|
||||||
|
|
||||||
|
# For all registered routers, load the zebra configuration file
|
||||||
|
for rname, router in router_list.iteritems():
|
||||||
|
router.load_config(
|
||||||
|
TopoRouter.RD_ZEBRA,
|
||||||
|
os.path.join(CWD, '{}/zebra.conf'.format(rname))
|
||||||
|
)
|
||||||
|
# Don't start ospfd and ldpd in the CE nodes
|
||||||
|
if router.name[0] == 'r':
|
||||||
|
router.load_config(
|
||||||
|
TopoRouter.RD_OSPF,
|
||||||
|
os.path.join(CWD, '{}/ospfd.conf'.format(rname))
|
||||||
|
)
|
||||||
|
router.load_config(
|
||||||
|
TopoRouter.RD_LDP,
|
||||||
|
os.path.join(CWD, '{}/ldpd.conf'.format(rname))
|
||||||
|
)
|
||||||
|
|
||||||
|
tgen.start_router()
|
||||||
|
|
||||||
|
def teardown_module(mod):
|
||||||
|
"Teardown the pytest environment"
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# This function tears down the whole topology.
|
||||||
|
tgen.stop_topology()
|
||||||
|
|
||||||
|
|
||||||
|
def router_compare_json_output(rname, command, reference):
|
||||||
|
"Compare router JSON output"
|
||||||
|
|
||||||
|
logger.info('Comparing router "%s" "%s" output', rname, command)
|
||||||
|
|
||||||
|
tgen = get_topogen()
|
||||||
|
filename = '{}/{}/{}'.format(CWD, rname, reference)
|
||||||
|
expected = json.loads(open(filename).read())
|
||||||
|
|
||||||
|
# Run test function until we get an result. Wait at most 80 seconds.
|
||||||
|
test_func = partial(topotest.router_json_cmp,
|
||||||
|
tgen.gears[rname], command, expected)
|
||||||
|
_, diff = topotest.run_and_expect(test_func, None, count=160, wait=0.5)
|
||||||
|
|
||||||
|
assertmsg = '"{}" JSON output mismatches the expected result'.format(rname)
|
||||||
|
assert diff is None, assertmsg
|
||||||
|
|
||||||
|
def test_ospf_convergence():
|
||||||
|
logger.info("Test: check OSPF adjacencies")
|
||||||
|
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show ip ospf neighbor json", "show_ip_ospf_neighbor.json")
|
||||||
|
|
||||||
|
def test_rib():
|
||||||
|
logger.info("Test: verify RIB")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show ip route json", "show_ip_route.ref")
|
||||||
|
|
||||||
|
def test_ldp_adjacencies():
|
||||||
|
logger.info("Test: verify LDP adjacencies")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show mpls ldp discovery json", "show_ldp_discovery.ref")
|
||||||
|
|
||||||
|
def test_ldp_neighbors():
|
||||||
|
logger.info("Test: verify LDP neighbors")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show mpls ldp neighbor json", "show_ldp_neighbor.ref")
|
||||||
|
|
||||||
|
def test_ldp_bindings():
|
||||||
|
logger.info("Test: verify LDP bindings")
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
# Skip if previous fatal error condition is raised
|
||||||
|
if tgen.routers_have_failure():
|
||||||
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
|
for rname in ['r1', 'r2', 'r3', 'r4']:
|
||||||
|
router_compare_json_output(rname, "show mpls ldp binding json", "show_ldp_binding.ref")
|
||||||
|
|
||||||
|
# Memory leak test template
|
||||||
|
def test_memory_leak():
|
||||||
|
"Run the memory leak test and report results."
|
||||||
|
tgen = get_topogen()
|
||||||
|
if not tgen.is_memleak_enabled():
|
||||||
|
pytest.skip('Memory leak test/report is disabled')
|
||||||
|
|
||||||
|
tgen.report_memory_leaks()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = ["-s"] + sys.argv[1:]
|
||||||
|
sys.exit(pytest.main(args))
|
@ -3,3 +3,4 @@ xx as to xx via inet 10.0.1.2 dev r1-eth0 proto xx
|
|||||||
xx via inet 10.0.1.2 dev r1-eth0 proto xx
|
xx via inet 10.0.1.2 dev r1-eth0 proto xx
|
||||||
xx via inet 10.0.1.2 dev r1-eth0 proto xx
|
xx via inet 10.0.1.2 dev r1-eth0 proto xx
|
||||||
xx via inet 10.0.1.2 dev r1-eth0 proto xx
|
xx via inet 10.0.1.2 dev r1-eth0 proto xx
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user