summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_route.c5
-rw-r--r--bgpd/bgp_route.h2
-rw-r--r--bgpd/bgp_updgrp_adv.c51
-rw-r--r--doc/user/snmp.rst1
-rw-r--r--lib/thread.c6
-rw-r--r--redhat/frr.spec.in345
-rw-r--r--tests/topotests/bgp_default-route/__init__.py (renamed from tests/topotests/bgp_default-route_route-map/__init__.py)0
-rw-r--r--tests/topotests/bgp_default-route/r1/bgpd.conf8
-rw-r--r--tests/topotests/bgp_default-route/r1/zebra.conf (renamed from tests/topotests/bgp_default-route_route-map/r1/zebra.conf)0
-rw-r--r--tests/topotests/bgp_default-route/r2/bgpd.conf (renamed from tests/topotests/bgp_default-route_route-map/r2/bgpd.conf)0
-rw-r--r--tests/topotests/bgp_default-route/r2/zebra.conf (renamed from tests/topotests/bgp_default-route_route-map/r2/zebra.conf)0
-rw-r--r--tests/topotests/bgp_default-route/test_bgp_default-originate.py114
-rw-r--r--tests/topotests/bgp_default-route_route-map_match/__init__.py0
-rw-r--r--tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf17
-rw-r--r--tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf11
-rw-r--r--tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf8
-rw-r--r--tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf6
-rw-r--r--tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py114
-rw-r--r--tests/topotests/bgp_default-route_route-map_match_set/__init__.py0
-rw-r--r--tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf18
-rw-r--r--tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf11
-rw-r--r--tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf8
-rw-r--r--tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf6
-rw-r--r--tests/topotests/bgp_default-route_route-map_match_set/test_bgp_default-originate_route-map_match_set.py (renamed from tests/topotests/bgp_default-route_route-map/test_bgp_default-originate_route-map.py)21
-rw-r--r--tests/topotests/bgp_default-route_route-map_set/__init__.py0
-rw-r--r--tests/topotests/bgp_default-route_route-map_set/r1/bgpd.conf (renamed from tests/topotests/bgp_default-route_route-map/r1/bgpd.conf)0
-rw-r--r--tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf9
-rw-r--r--tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf8
-rw-r--r--tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf6
-rw-r--r--tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py114
30 files changed, 830 insertions, 59 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index da1fabf985..566c5911e0 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1687,7 +1687,7 @@ void bgp_notify_conditional_adv_scanner(struct update_subgroup *subgrp)
}
-static void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr)
+void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr)
{
if (family == AF_INET) {
attr->nexthop.s_addr = INADDR_ANY;
@@ -13822,7 +13822,8 @@ DEFPY_YANG(bgp_distance_source,
NO_STR
"Define an administrative distance\n"
"Distance value\n"
- "IP source prefix\n"
+ "IPv4 source prefix\n"
+ "IPv6 source prefix\n"
"Access list name\n")
{
afi_t afi;
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 43744044b4..e4c6f9a0e2 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -757,5 +757,5 @@ extern int bgp_distance_set(uint8_t distance, const char *ip_str,
extern int bgp_distance_unset(uint8_t distance, const char *ip_str,
const char *access_list_str, afi_t afi,
safi_t safi, char *errmsg, size_t errmsg_len);
-
+extern void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr);
#endif /* _QUAGGA_BGP_ROUTE_H */
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index ac77ccd8a4..3cfb73d8a8 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -731,7 +731,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
struct bgp *bgp;
struct attr attr;
struct attr *new_attr = &attr;
- struct aspath *aspath;
struct prefix p;
struct peer *from;
struct bgp_dest *dest;
@@ -756,7 +755,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
from = bgp->peer_self;
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
- aspath = attr.aspath;
attr.local_pref = bgp->default_local_pref;
@@ -772,12 +770,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
}
if (peer->default_rmap[afi][safi].name) {
- struct attr attr_tmp = attr;
- struct bgp_path_info bpi_rmap = {0};
-
- bpi_rmap.peer = bgp->peer_self;
- bpi_rmap.attr = &attr_tmp;
-
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_DEFAULT);
/* Iterate over the RIB to see if we can announce
@@ -789,20 +781,45 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
if (!bgp_dest_has_bgp_path_info_data(dest))
continue;
- ret = route_map_apply(peer->default_rmap[afi][safi].map,
- bgp_dest_get_prefix(dest),
- RMAP_BGP, &bpi_rmap);
+ for (pi = bgp_dest_get_bgp_path_info(dest); pi;
+ pi = pi->next) {
+ struct attr tmp_attr;
+ struct bgp_path_info tmp_pi;
+ struct bgp_path_info_extra tmp_pie;
+
+ tmp_attr = *pi->attr;
+
+ prep_for_rmap_apply(&tmp_pi, &tmp_pie, dest, pi,
+ pi->peer, &tmp_attr);
- if (ret != RMAP_DENYMATCH)
+ ret = route_map_apply(
+ peer->default_rmap[afi][safi].map,
+ bgp_dest_get_prefix(dest), RMAP_BGP,
+ &tmp_pi);
+
+ if (ret == RMAP_DENYMATCH) {
+ bgp_attr_flush(&tmp_attr);
+ continue;
+ } else {
+ new_attr = bgp_attr_intern(&tmp_attr);
+ new_attr->aspath = attr.aspath;
+
+ subgroup_announce_reset_nhop(
+ (peer_cap_enhe(peer, afi, safi)
+ ? AF_INET6
+ : AF_INET),
+ new_attr);
+
+ break;
+ }
+ }
+ if (ret == RMAP_PERMITMATCH)
break;
}
bgp->peer_self->rmap_type = 0;
- new_attr = bgp_attr_intern(&attr_tmp);
- if (ret == RMAP_DENYMATCH) {
- bgp_attr_flush(&attr_tmp);
+ if (ret == RMAP_DENYMATCH)
withdraw = 1;
- }
}
/* Check if the default route is in local BGP RIB which is
@@ -881,8 +898,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
subgroup_default_update_packet(subgrp, new_attr, from);
}
}
-
- aspath_unintern(&aspath);
}
/*
diff --git a/doc/user/snmp.rst b/doc/user/snmp.rst
index d214926245..0087d41a23 100644
--- a/doc/user/snmp.rst
+++ b/doc/user/snmp.rst
@@ -39,6 +39,7 @@ can be achieved by amending the default view from SNMP
:file:`/etc/snmp/snmpd.conf`:
::
+
# This is the default view
view all included .1 80
# Remove ipRouteTable from view
diff --git a/lib/thread.c b/lib/thread.c
index 8da5aa61dd..db53e267f8 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1233,9 +1233,9 @@ void thread_cancel(struct thread **thread)
master = (*thread)->master;
- frrtrace(9, frr_libfrr, thread_cancel, master, thread->funcname,
- thread->schedfrom, thread->schedfrom_line, NULL, thread->u.fd,
- thread->u.val, thread->arg, thread->u.sands.tv_sec);
+ frrtrace(9, frr_libfrr, thread_cancel, master, (*thread)->funcname,
+ (*thread)->schedfrom, (*thread)->schedfrom_line, NULL, (*thread)->u.fd,
+ (*thread)->u.val, (*thread)->arg, (*thread)->u.sands.tv_sec);
assert(master->owner == pthread_self());
diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in
index bd0d5b27f4..e72d2e3f36 100644
--- a/redhat/frr.spec.in
+++ b/redhat/frr.spec.in
@@ -25,7 +25,6 @@
%{!?with_pbrd: %global with_pbrd 1 }
%{!?with_pimd: %global with_pimd 1 }
%{!?with_vrrpd: %global with_vrrpd 1 }
-%{!?with_rpki: %global with_rpki 0 }
%{!?with_rtadv: %global with_rtadv 1 }
%{!?with_watchfrr: %global with_watchfrr 1 }
@@ -192,9 +191,6 @@ Requires: initscripts
%if %{with_pam}
BuildRequires: pam-devel
%endif
-%if %{with_rpki}
-BuildRequires: librtr-devel >= 0.5
-%endif
%if "%{initsystem}" == "systemd"
BuildRequires: systemd
BuildRequires: systemd-devel
@@ -261,6 +257,32 @@ The frr-devel package contains the header and object files neccessary for
developing OSPF-API and frr applications.
+%package rpki-rtrlib
+Summary: BGP RPKI support (rtrlib)
+Group: System Environment/Daemons
+BuildRequires: librtr-devel >= 0.5
+Requires: %{name} = %{version}-%{release}
+
+%description rpki-rtrlib
+Adds RPKI support to FRR's bgpd, allowing validation of BGP routes
+against cryptographic information stored in WHOIS databases. This is
+used to prevent hijacking of networks on the wider internet. It is only
+relevant to internet service providers using their own autonomous system
+number.
+
+
+%package snmp
+Summary: SNMP support
+Group: System Environment/Daemons
+BuildRequires: net-snmp-devel
+Requires: %{name} = %{version}-%{release}
+
+%description snmp
+Adds SNMP support to FRR's daemons by attaching to net-snmp's snmpd
+through the AgentX protocol. Provides read-only access to current
+routing state through standard SNMP MIBs.
+
+
%prep
%setup -q -n frr-%{frrversion}
@@ -370,16 +392,13 @@ developing OSPF-API and frr applications.
%if "%{initsystem}" == "systemd"
--enable-systemd \
%endif
-%if %{with_rpki}
--enable-rpki \
-%else
- --disable-rpki \
-%endif
%if %{with_bfdd}
--enable-bfdd \
%else
--disable-bfdd \
%endif
+ --enable-snmp
# end
make %{?_smp_mflags} MAKEINFO="makeinfo --no-split"
@@ -425,10 +444,6 @@ ln -s %{_sbindir}/frrinit.sh %{buildroot}%{_initddir}/frr
%endif
install %{zeb_src}/tools/etc/frr/daemons %{buildroot}%{_sysconfdir}/frr
-# add rpki module to daemon
-%if %{with_rpki}
- sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{buildroot}%{_sysconfdir}/frr/daemons
-%endif
install -m644 %{zeb_rh_src}/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr
install -m644 %{zeb_rh_src}/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr
install -d -m750 %{buildroot}%{rundir}
@@ -666,14 +681,12 @@ fi
%if %{with_bfdd}
%{_sbindir}/bfdd
%endif
-%{_libdir}/lib*.so.0
-%{_libdir}/lib*.so.0.*
+%{_libdir}/libfrr.so*
+%{_libdir}/libfrrcares*
+%{_libdir}/libfrrospf*
%if %{with_fpm}
%{_libdir}/frr/modules/zebra_fpm.so
%endif
-%if %{with_rpki}
- %{_libdir}/frr/modules/bgpd_rpki.so
-%endif
%{_libdir}/frr/modules/zebra_cumulus_mlag.so
%{_libdir}/frr/modules/dplane_fpm_nl.so
%{_libdir}/frr/modules/zebra_irdp.so
@@ -706,12 +719,28 @@ fi
%else
%{_sbindir}/generate_support_bundle.pyc
%{_sbindir}/generate_support_bundle.pyo
-%{_sbindir}/frr-reload.py
%{_sbindir}/frr-reload.pyc
%{_sbindir}/frr-reload.pyo
%endif
+%post rpki-rtrlib
+# add rpki module to daemons
+sed -i -e 's/^\(bgpd_options=\)\(.*\)\(".*\)/\1\2 -M rpki\3/' %{_sysconfdir}/frr/daemons
+
+%postun rpki-rtrlib
+# remove rpki module from daemons
+sed -i 's/ -M rpki//' %{_sysconfdir}/frr/daemons
+
+%files rpki-rtrlib
+%{_libdir}/frr/modules/bgpd_rpki.so
+
+
+%files snmp
+%{_libdir}/libfrrsnmp.so*
+%{_libdir}/frr/modules/*snmp.so
+
+
%files devel
%{_libdir}/lib*.so
%dir %{_includedir}/%{name}
@@ -729,10 +758,288 @@ fi
%changelog
+* Fri Oct 30 2020 Martin Winter <mwinter@opensourcerouting.org> - %{version}
+- Moved RPKI to subpackage
+- Added SNMP subpackage
+
+* Tue Jun 30 2020 Martin Winter <mwinter@opensourcerouting.org> - 7.4
+- BGPd
+- Use sequence numbers for community lists
+- Fixes to nexthop groups
+- Add feature to limit outgoing number of routes
+- Per Neighbor Graceful Restart
+- Multiple Graceful Restart fixes
+- Support sub-Type-4 and sub-Type-5 for the VPNv4 SRv6 backend
+- rfc7606 support: treat certain malformed routes as withdraw
+- allow origin override for route aggregates
+- rfc6608 support: Subcodes for BGP Finite State Machine Error
+- rfc7607 support: Codification of AS 0 Processing
+- rfc6286 support: Autonomous-System-Wide Unique BGP Identifier for BGP-4
+- Unequal cost multipath (a.ka. weighted ECMP) with BGP link-bandwidth
+- Enable rfc8212 by default except datacenter profile
+- staticd
+- Add debug support
+- vtysh
+- Add copy command to copy config from file into running config
+- LDPd
+- adding support for LDP ordered label distribution control
+- ISISd
+- IS-IS Segment Routing support
+- SHARPd
+- add initial support to add/remove lsps
+- Zebra
+- fix broadcast address in IPv4 networks with /31 mask
+- Add Graceful Restart support for Protocol Daemon restarts
+- lib
+- migrate route-maps to use northbound interface
+- plus countless bug fixes and other improvements
+
+* Wed May 06 2020 David Lamparter <equinox@opensourcerouting.org> - 7.3.1
+- upstream 7.3.1
+
+* Fri Feb 14 2020 Martin Winter <mwinter@opensourcerouting.org> - 7.3
+- BGPd
+- EVPN PIP Support
+- Route Aggregation code speed ups
+- BGP Vector I/O speed ups
+- New CLI: `set distance XXX`
+- New CLI: `aggregate-address A.B.C.D/M route-map WORD`
+- New CLI: `bgp reject-as-sets`
+- New CLI: `advertise pip ...`
+- New CLI: `match evpn rd ASN:NN_OR_IP-ADDRESS:NN`
+- New CLI: `show bgp l2vpn evpn community|large-community X`
+- New CLI: `show bgp l2vpn evpn A.B.C.D`
+- Auto-completion for clear bgp command
+- Add ability to set tcp socket buffer size
+- OSPFd
+- Partial MPLS TE support
+- PBRd
+- New CLI: `set vrf unchanged|NAME`
+- BFDd
+- VRF Support
+- New CLI: 'show bfd peers brief'
+- New CLI: 'clear bfd peer ...'
+- PIMd
+- Significant Speedups in accessing Internal Data for higher scale
+- Support for joining any-source Multicast
+- Updated CLI: 'show ip pim upstream-join-desired'
+- New CLI: 'show ip pim channel'
+- Debug Cleanup
+- MLAG experimental support
+- VRRPd
+- VRF Support
+- Northbound Conversion- NHRPd
+- LDPd
+- vtysh
+- New CLI: `banner motd line LINE...`
+- yang
+- New CLI: `show yang operational-data XPATH`
+- New CLI: `debug northbound`
+- Zebra
+- Nexthop Group support
+- New CLI: 'debug zebra nexthop [detail]'
+- New CLI: 'show router-id'
+- MLAG experimental support
+- watchfrr
+- Additional status messages of system state to systemd
+- New CLI: `watchfrr ignore DAEMON`
+- Others
+- As always all daemons have received too many bug fixes to fully list
+- There has been a significant focus on increasing test coverage
+- Change in Behavior:
+- ISISd
+- All areas created default automatically to level-1-2
+- Zebra
+- Nexthop Group Installation in Kernel is turned on by default
+ if the kernel supports- New CLI: 'show nexthop-group rib [singleton]'
+- Man Pages
+- Renamed to frr-* to remove collision with other packages
+
+* Fri Jan 17 2020 Martin Winter <mwinter@opensourcerouting.org> - 7.2.1
+- BGPd
+- Fix Addpath issue
+- Do not apply eBGP policy for iBGP peers
+- Show `ip` and `fqdn` in json output for `show [ip] bgp <route> json`
+- Fix large route-distinguisher's format
+- Fix `no bgp listen range ...` configuration command
+- Autocomplete neighbor for clear bgp
+- Reflect the distance in RIB when it is changed for an arbitrary afi/safi
+- Notify "Peer De-configured" after entering 'no neighbor <neighbor> cmd
+- Fix per afi/safi addpath peer counting
+- Rework BGP dampening to be per AFI/SAFI
+- Do not send next-hop as :: in MP_REACH_NLRI if no link-local exists
+- Override peer's TTL only if peer-group is configured with TTL
+- Remove error message for unkown afi/safi combination
+- Keep the session down if maximum-prefix is reached
+- OSPFd
+- Fix BFD down not tearing down OSPF adjacency for point-to-point net
+- BFDd
+- Fix multiple VRF handling
+- VRF security improvement
+- PIMd
+- Fix rp crash
+- NHRPd
+- Make sure `no ip nhrp map <something>` works as expected
+- LDPd
+- Add missing sanity check in the parsing of label messages
+- Zebra
+- Use correct state when installing evpn macs
+- Capture dplane plugin flags
+- lib
+- Fix interface config when vrf changes
+- Fix Interface Infinite Loop Walk (for special interfaces such as bond)
+- snapcraft
+- fix missing vrrpd daemon
+- Others
+- Rename man pages (to avoid conflicts with other packages)
+- Various other fixes for code cleanup and memory leaks
+
* Fri Dec 27 2019 Donatas Abraitis <donatas.abraitis@gmail.com>
- Add CentOS 8 support
-* Mon May 28 2018 Rafael Zalamena <rzalamena@opensourcerouting.org> - %{version}
+* Tue Oct 15 2019 Martin Winter <mwinter@opensourcerouting.org> - 7.2
+- ALL Daemons
+- -N <namespace> to allow for config file locating when running FRR inside
+ of a namespace
+- Impoved Testing across all daemons
+- BFD
+- VRF Support
+- Conversion to Northbound interface
+- BGP
+- Aggregate-address add route-map support
+- BMP Support
+- Improved JSON output for many commands
+- `show bgp afi safi summary failed` command
+- `clear bop *` clears all peers
+- Show FQDN for `show bgp ipv4 uni` commands
+- Display BestPath selection reason as part of show commands
+- EIGRP
+- Infrastructure changes to allow VRF's
+- SIGHUP signals the config reload
+- Conversion to Northbound interface
+- ISIS
+- BFD Support
+- Support for circuits with MTU > 8192
+- PBRD
+- fwmark support as part of match criteria
+- autocompletion of PBRMAPS
+- Improved Nexthop Support
+- PIMD
+- PIM-BSM receive support
+- Improved debugging support
+- Store ECMP paths that are not currently legal for use
+- Disallow igmp query from a non-connected source
+- Many new cli improvements and changes
+- VRRPD
+- Add Support for RFC 3768 and RFC 5798
+- Route-Maps
+- Add sequence numbers to access-lists
+- Add `match ip next-hop type blackhole`
+- Improved ability to notice dependency changes
+- SHARPD
+- `sharp watch [import|nexthop]` you can now specify a prefix instead
+ of assuming a /32
+- STATICD
+- Significantly Improved NHT
+- ZEBRA
+- Many dataplane improvements for routes, neighbor table and EVPN
+- NHT cli can now be specified per VRF and improved ability to control
+ NHT data being shown
+- Removed duplicate processing of routes
+- Improved debugablility
+- RMAC and VxLan support for the FPM
+- LIB
+- RCU support
+- Nexthop Group Improvements
+- `log-filter WORD` added
+- Building
+- openssl support
+- libcap should be used as part of build or significant slowdowns
+ will be experienced
+- Lua builds have been fixed
+- Improved Cross building
+
+* Mon Jun 17 2019 David Lamparter <equinox@opensourcerouting.org> - 7.1
+- gRPC northbound plugin
+- "table NNN" removed from zebra
+- more dataplane MT work
+- EVPN in non-default VRFs
+- RFC 8212 (default deny policy for eBGP)
+- RFC 8106 (IPv6 RA DNS options)
+
+* Wed May 8 2019 Martin Winter <mwinter@opensourcerouting.org> - 7.0.1
+- bgp:
+- Don't send Updates with BGP Max-Prefix Overflow
+- Make sure `next-hop-self all` backward compatible with force
+- Fix as-path validation in "show bgp regexp"
+- Fix interface-based peers to override peergroups
+- Fix removing private AS numbers if local-as is used
+- Fix show bgp labeled_unicast
+- Add command to lookup prefixes in rpki table
+- Fix peer count in "show bgp ipv6 summary"
+- Add missing ipv6 only peer flag action
+- Fix address family output in "show bgp [ipv4|ipv6] neighbors"
+- Add missing checks for vpnv6 nexthops
+- Fix nexthop for ipv6 vpn case
+- rip: Fix removal of passive interfaces
+- ospf:
+- Fix json timer output
+- Fix milliseconds in json output
+- bfd:
+- Fix source port according RFC 5881, Sec 4
+- Fix IPv6 link-local peer removal
+- Fix interface clean up when deleting interface
+- pim: Fix interface clean up when deleting interface
+- nhrp: Fix interface clean up when deleting interface
+- lib:
+- Workaround to get FRR building with libyang 0.x and 1.x
+- Fix in priv handling
+- Make priv elevation thread-safe
+- zebra:
+- Pseudowire event recovery
+- Fix race condition in label manager
+- Fix system routes selection and next-hop tracking
+- Set connected route metric based on devaddr metric
+- Display metric for connected routes
+- Add selected fib details to json output
+- Always use replace if installing new route
+- watchfrr: Silently ignore declare failures (for backward compatibility)
+- RPM packages: Switch to new init script
+
+* Thu Feb 28 2019 Martin Winter <mwinter@opensourcerouting.org> - 7.0
+- Added libyang dependency: New work for northbound interface based on libyang
+- Fabricd: New Daemon based on https://datatracker.ietf.org/doc/draft-white-openfabric/
+- various bug fixes and other enhancements
+
+* Sun Oct 7 2018 Martin Winter <mwinter@opensourcerouting.org> - 6.0
+- Staticd: New daemon responsible for management of static routes
+- ISISd: Implement dst-src routing as per draft-ietf-isis-ipv6-dst-src-routing
+- BFDd: new daemon for BFD (Bidrectional Forwarding Detection). Responsible
+ for notifying link changes to make routing protocols converge faster.
+- various bug fixes
+
+* Thu Jul 5 2018 Martin Winter <mwinter@opensourcerouting.org> - 5.0.1
+- Support Automake 1.16.1
+- BGPd: Support for flowspec ICMP, DSCP, packet length, fragment and tcp flags
+- BGPd: fix rpki validation for ipv6
+- VRF: Workaround for kernel bug on Linux 4.14 and newer
+- Zebra: Fix interface based routes from zebra not marked up
+- Zebra: Fix large zebra memory usage when redistribute between protocols
+- Zebra: Allow route-maps to match on source instance
+- BGPd: Backport peer-attr overrides, peer-level enforce-first-as and filtered-routes fix
+- BGPd: fix for crash during display of filtered-routes
+- BGPd: Actually display labeled unicast routes received
+- Label Manager: Fix to work correctly behind a label manager proxy
+
+* Thu Jun 7 2018 Martin Winter <mwinter@opensourcerouting.org> - 5.0
+- PIM: Add a Multicast Trace Command draft-ietf-idmr-traceroute-ipm-05
+- IS-IS: Implement Three-Way Handshake as per RFC5303
+- BGPD: Implement VPN-VRF route leaking per RFC4364.
+- BGPD: Implement VRF with NETNS backend
+- BGPD: Flowspec
+- PBRD: Add a new Policy Based Routing Daemon
+
+* Mon May 28 2018 Rafael Zalamena <rzalamena@opensourcerouting.org>
- Add BFDd support
* Sun May 20 2018 Martin Winter <mwinter@opensourcerouting.org>
diff --git a/tests/topotests/bgp_default-route_route-map/__init__.py b/tests/topotests/bgp_default-route/__init__.py
index e69de29bb2..e69de29bb2 100644
--- a/tests/topotests/bgp_default-route_route-map/__init__.py
+++ b/tests/topotests/bgp_default-route/__init__.py
diff --git a/tests/topotests/bgp_default-route/r1/bgpd.conf b/tests/topotests/bgp_default-route/r1/bgpd.conf
new file mode 100644
index 0000000000..8699d62ff2
--- /dev/null
+++ b/tests/topotests/bgp_default-route/r1/bgpd.conf
@@ -0,0 +1,8 @@
+router bgp 65000
+ no bgp ebgp-requires-policy
+ neighbor 192.168.255.2 remote-as 65001
+ neighbor 192.168.255.2 timers 3 10
+ address-family ipv4 unicast
+ neighbor 192.168.255.2 default-originate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_default-route_route-map/r1/zebra.conf b/tests/topotests/bgp_default-route/r1/zebra.conf
index 0a283c06d5..0a283c06d5 100644
--- a/tests/topotests/bgp_default-route_route-map/r1/zebra.conf
+++ b/tests/topotests/bgp_default-route/r1/zebra.conf
diff --git a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf b/tests/topotests/bgp_default-route/r2/bgpd.conf
index 00c96cc58b..00c96cc58b 100644
--- a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf
+++ b/tests/topotests/bgp_default-route/r2/bgpd.conf
diff --git a/tests/topotests/bgp_default-route_route-map/r2/zebra.conf b/tests/topotests/bgp_default-route/r2/zebra.conf
index 606c17bec9..606c17bec9 100644
--- a/tests/topotests/bgp_default-route_route-map/r2/zebra.conf
+++ b/tests/topotests/bgp_default-route/r2/zebra.conf
diff --git a/tests/topotests/bgp_default-route/test_bgp_default-originate.py b/tests/topotests/bgp_default-route/test_bgp_default-originate.py
new file mode 100644
index 0000000000..d8de0f0ac6
--- /dev/null
+++ b/tests/topotests/bgp_default-route/test_bgp_default-originate.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2019-2020 by
+# Donatas Abraitis <donatas.abraitis@gmail.com>
+#
+# 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 if default-originate works without route-map.
+"""
+
+import os
+import sys
+import json
+import time
+import pytest
+import functools
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+from mininet.topo import Topo
+
+
+class TemplateTopo(Topo):
+ def build(self, *_args, **_opts):
+ tgen = get_topogen(self)
+
+ for routern in range(1, 3):
+ tgen.add_router("r{}".format(routern))
+
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
+
+
+def setup_module(mod):
+ tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen.start_topology()
+
+ router_list = tgen.routers()
+
+ for i, (rname, router) in enumerate(router_list.items(), 1):
+ router.load_config(
+ TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
+ )
+
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ tgen = get_topogen()
+ tgen.stop_topology()
+
+
+def test_bgp_default_originate_route_map():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ router = tgen.gears["r2"]
+
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json"))
+ expected = {
+ "192.168.255.1": {
+ "bgpState": "Established",
+ "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}},
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ def _bgp_default_route_is_valid(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json"))
+ expected = {"paths": [{"valid": True}]}
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_converge, router)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+
+ assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
+
+ test_func = functools.partial(_bgp_default_route_is_valid, router)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+
+ assert (
+ result is None
+ ), 'Failed to see applied metric for default route in "{}"'.format(router)
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_default-route_route-map_match/__init__.py b/tests/topotests/bgp_default-route_route-map_match/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match/__init__.py
diff --git a/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf
new file mode 100644
index 0000000000..97b440f5ce
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf
@@ -0,0 +1,17 @@
+router bgp 65000
+ no bgp ebgp-requires-policy
+ neighbor 192.168.255.2 remote-as 65001
+ neighbor 192.168.255.2 timers 3 10
+ address-family ipv4 unicast
+ network 192.168.13.0/24 route-map internal
+ neighbor 192.168.255.2 default-originate route-map default
+ exit-address-family
+!
+bgp community-list standard default seq 5 permit 65000:1
+!
+route-map default permit 10
+ match community default
+!
+route-map internal permit 10
+ set community 65000:1
+!
diff --git a/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf
new file mode 100644
index 0000000000..9e581a7be7
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf
@@ -0,0 +1,11 @@
+!
+interface lo
+ ip address 172.16.255.254/32
+!
+interface r1-eth0
+ ip address 192.168.255.1/24
+!
+ip route 192.168.13.0./24 Null0
+!
+ip forwarding
+!
diff --git a/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf
new file mode 100644
index 0000000000..00c96cc58b
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf
@@ -0,0 +1,8 @@
+router bgp 65001
+ no bgp ebgp-requires-policy
+ neighbor 192.168.255.1 remote-as 65000
+ neighbor 192.168.255.1 timers 3 10
+ address-family ipv4 unicast
+ redistribute connected
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf
new file mode 100644
index 0000000000..606c17bec9
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf
@@ -0,0 +1,6 @@
+!
+interface r2-eth0
+ ip address 192.168.255.2/24
+!
+ip forwarding
+!
diff --git a/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py b/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py
new file mode 100644
index 0000000000..089c9a964e
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2019-2020 by
+# Donatas Abraitis <donatas.abraitis@gmail.com>
+#
+# 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 if default-originate works with ONLY match operations.
+"""
+
+import os
+import sys
+import json
+import time
+import pytest
+import functools
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+from mininet.topo import Topo
+
+
+class TemplateTopo(Topo):
+ def build(self, *_args, **_opts):
+ tgen = get_topogen(self)
+
+ for routern in range(1, 3):
+ tgen.add_router("r{}".format(routern))
+
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
+
+
+def setup_module(mod):
+ tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen.start_topology()
+
+ router_list = tgen.routers()
+
+ for i, (rname, router) in enumerate(router_list.items(), 1):
+ router.load_config(
+ TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
+ )
+
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ tgen = get_topogen()
+ tgen.stop_topology()
+
+
+def test_bgp_default_originate_route_map():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ router = tgen.gears["r2"]
+
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json"))
+ expected = {
+ "192.168.255.1": {
+ "bgpState": "Established",
+ "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}},
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ def _bgp_default_route_is_valid(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json"))
+ expected = {"paths": [{"valid": True}]}
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_converge, router)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+
+ assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
+
+ test_func = functools.partial(_bgp_default_route_is_valid, router)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+
+ assert (
+ result is None
+ ), 'Failed to see applied metric for default route in "{}"'.format(router)
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_default-route_route-map_match_set/__init__.py b/tests/topotests/bgp_default-route_route-map_match_set/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match_set/__init__.py
diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf
new file mode 100644
index 0000000000..6ef8b1c0f4
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf
@@ -0,0 +1,18 @@
+router bgp 65000
+ no bgp ebgp-requires-policy
+ neighbor 192.168.255.2 remote-as 65001
+ neighbor 192.168.255.2 timers 3 10
+ address-family ipv4 unicast
+ network 192.168.13.0/24 route-map internal
+ neighbor 192.168.255.2 default-originate route-map default
+ exit-address-family
+!
+bgp community-list standard default seq 5 permit 65000:1
+!
+route-map default permit 10
+ match community default
+ set metric 123
+!
+route-map internal permit 10
+ set community 65000:1
+!
diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf
new file mode 100644
index 0000000000..9e581a7be7
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf
@@ -0,0 +1,11 @@
+!
+interface lo
+ ip address 172.16.255.254/32
+!
+interface r1-eth0
+ ip address 192.168.255.1/24
+!
+ip route 192.168.13.0./24 Null0
+!
+ip forwarding
+!
diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf
new file mode 100644
index 0000000000..00c96cc58b
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf
@@ -0,0 +1,8 @@
+router bgp 65001
+ no bgp ebgp-requires-policy
+ neighbor 192.168.255.1 remote-as 65000
+ neighbor 192.168.255.1 timers 3 10
+ address-family ipv4 unicast
+ redistribute connected
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf
new file mode 100644
index 0000000000..606c17bec9
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf
@@ -0,0 +1,6 @@
+!
+interface r2-eth0
+ ip address 192.168.255.2/24
+!
+ip forwarding
+!
diff --git a/tests/topotests/bgp_default-route_route-map/test_bgp_default-originate_route-map.py b/tests/topotests/bgp_default-route_route-map_match_set/test_bgp_default-originate_route-map_match_set.py
index a72c3a4cbf..d9ea5db278 100644
--- a/tests/topotests/bgp_default-route_route-map/test_bgp_default-originate_route-map.py
+++ b/tests/topotests/bgp_default-route_route-map_match_set/test_bgp_default-originate_route-map_match_set.py
@@ -1,10 +1,6 @@
#!/usr/bin/env python
-#
-# bgp_default-originate_route-map.py
-# Part of NetDEF Topology Tests
-#
-# Copyright (c) 2019 by
+# Copyright (c) 2020 by
# Donatas Abraitis <donatas.abraitis@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software
@@ -23,15 +19,8 @@
#
"""
-bgp_default-originate_route-map.py:
-
-Test if works the following commands:
-router bgp 65031
- address-family ipv4 unicast
- neighbor 192.168.255.2 default-originate route-map default
-
-route-map default permit 10
- set metric 123
+Test if default-originate works with match operations.
+And verify if set operations work as well.
"""
import os
@@ -109,12 +98,12 @@ def test_bgp_default_originate_route_map():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
test_func = functools.partial(_bgp_default_route_has_metric, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert (
result is None
diff --git a/tests/topotests/bgp_default-route_route-map_set/__init__.py b/tests/topotests/bgp_default-route_route-map_set/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_set/__init__.py
diff --git a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_set/r1/bgpd.conf
index cb07ea9fdf..cb07ea9fdf 100644
--- a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf
+++ b/tests/topotests/bgp_default-route_route-map_set/r1/bgpd.conf
diff --git a/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf
new file mode 100644
index 0000000000..0a283c06d5
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf
@@ -0,0 +1,9 @@
+!
+interface lo
+ ip address 172.16.255.254/32
+!
+interface r1-eth0
+ ip address 192.168.255.1/24
+!
+ip forwarding
+!
diff --git a/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf
new file mode 100644
index 0000000000..00c96cc58b
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf
@@ -0,0 +1,8 @@
+router bgp 65001
+ no bgp ebgp-requires-policy
+ neighbor 192.168.255.1 remote-as 65000
+ neighbor 192.168.255.1 timers 3 10
+ address-family ipv4 unicast
+ redistribute connected
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf
new file mode 100644
index 0000000000..606c17bec9
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf
@@ -0,0 +1,6 @@
+!
+interface r2-eth0
+ ip address 192.168.255.2/24
+!
+ip forwarding
+!
diff --git a/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py b/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py
new file mode 100644
index 0000000000..9a22c58b16
--- /dev/null
+++ b/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2019-2020 by
+# Donatas Abraitis <donatas.abraitis@gmail.com>
+#
+# 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 if default-originate works with ONLY set operations.
+"""
+
+import os
+import sys
+import json
+import time
+import pytest
+import functools
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+from mininet.topo import Topo
+
+
+class TemplateTopo(Topo):
+ def build(self, *_args, **_opts):
+ tgen = get_topogen(self)
+
+ for routern in range(1, 3):
+ tgen.add_router("r{}".format(routern))
+
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
+
+
+def setup_module(mod):
+ tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen.start_topology()
+
+ router_list = tgen.routers()
+
+ for i, (rname, router) in enumerate(router_list.items(), 1):
+ router.load_config(
+ TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
+ )
+
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ tgen = get_topogen()
+ tgen.stop_topology()
+
+
+def test_bgp_default_originate_route_map():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ router = tgen.gears["r2"]
+
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json"))
+ expected = {
+ "192.168.255.1": {
+ "bgpState": "Established",
+ "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}},
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ def _bgp_default_route_has_metric(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json"))
+ expected = {"paths": [{"metric": 123}]}
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_converge, router)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+
+ assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
+
+ test_func = functools.partial(_bgp_default_route_has_metric, router)
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+
+ assert (
+ result is None
+ ), 'Failed to see applied metric for default route in "{}"'.format(router)
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))