sonic-buildimage/src
pavel-shirshov bee6c87f90 [bgpcfgd]: Change prefix-list generation for "Allow prefix" feature (#5639)
**- Why I did it**
I was asked to change "Allow list" prefix-list generation rule.
Previously we generated the rules using following method:
``` 
For each {prefix}/{masklen} we would generate the prefix-rule
permit {prefix}/{masklen} ge {masklen}+1
Example:
Prefix 1.2.3.4/24 would have following prefix-list entry generated
permit 1.2.3.4/24 ge 23
```
But we discovered the old rule doesn't work for all cases we have.

So we introduced the new rule:
```
For ipv4 entry,  
For mask  < 32 , we will add ‘le 32’ to cover all  prefix masks to be sent by T0  
For mask =32 , we will not add any ‘le mask’ 
For ipv6 entry, we will add le 128 to cover all the prefix mask to be sent by T0  
For mask < 128 , we will add ‘le 128’ to cover all prefix masks to be sent by T0 
For mask = 128 , we will not add any ‘le mask’ 
```    

**- How I did it**
I change prefix-list entry generation function. Also I introduced a test for the changed function.

**- How to verify it**
1. Build an image and put it on your dut.

2. Create a file test_schema.conf with the test configuration
```
{
    "BGP_ALLOWED_PREFIXES": {
        "DEPLOYMENT_ID|0|1010:1010": {
            "prefixes_v4": [
                "10.20.0.0/16",
                "10.50.1.0/29"
            ],
            "prefixes_v6": [
                "fc01:10::/64",
                "fc02:20::/64"
            ]
        },
        "DEPLOYMENT_ID|0": {
            "prefixes_v4": [
                "10.20.0.0/16",
                "10.50.1.0/29"
            ],
            "prefixes_v6": [
                "fc01:10::/64",
                "fc02:20::/64"
            ]
        }
    }
}
```

3. Apply the configuration by command 
```
sonic-cfggen -j test_schema.conf --write-to-db
```

4. Check that your bgp configuration has following prefix-list entries:
```
admin@str-s6100-acs-1:~$ show runningconfiguration bgp | grep PL_ALLOW
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V4 seq 10 deny 0.0.0.0/0 le 17
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V4 seq 20 permit 127.0.0.1/32
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V4 seq 30 permit 10.20.0.0/16 le 32
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V4 seq 40 permit 10.50.1.0/29 le 32
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V4 seq 20 permit 127.0.0.1/32
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V4 seq 30 permit 10.20.0.0/16 le 32
ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V4 seq 40 permit 10.50.1.0/29 le 32
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V6 seq 10 deny ::/0 le 59
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V6 seq 20 deny ::/0 ge 65
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V6 seq 30 permit fc01:10::/64 le 128
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_1010:1010_V6 seq 40 permit fc02:20::/64 le 128
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V6 seq 30 permit fc01:10::/64 le 128
ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_0_COMMUNITY_empty_V6 seq 40 permit fc02:20::/64 le 128

``` 

Co-authored-by: Pavel Shirshov <pavel.contrib@gmail.com>
2020-10-30 08:56:52 -07:00
..
bash [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
dhcpmon [dhcpmon] Print Both Snapshot And Current Counters (#5374) 2020-09-19 14:06:25 -07:00
gobgp Update go version to 1.11.2 for gobgp and telemetry (#2230) 2018-11-09 21:56:39 -08:00
hiredis [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
ifupdown2 [baseimage]: Upgrade ifupdown2 to version 1.2.8 (#3180) 2019-07-19 23:09:14 -07:00
initramfs-tools [baseimage]: Build specific revision of initramfs-tools (#1957) 2018-08-21 00:00:46 -07:00
iproute2 [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
iptables Changes in sonic-buildimage to support the NAT feature (#3494) 2020-02-03 15:30:39 -08:00
isc-dhcp [isc-dhcp-relay] Patch to allow relay to discover interfaces even if (#3851) 2019-12-18 11:06:40 -08:00
ixgbe Upgrade linux-image version (#1294) 2018-01-31 11:39:48 -08:00
kdump-tools [baseimage]: kdump support (#3722) 2019-11-08 23:08:42 -08:00
libnl3 [libnl]: Debian Packaging libnl version 3.5.0 (#3967) 2020-02-03 15:46:17 -08:00
libteam [libteam]: Disregard current state when considering port enablement (#4215) 2020-03-04 11:58:41 -08:00
libyang libyang 1.0.73 (#3710) 2019-11-07 13:45:38 -08:00
lldpd [lldpd]: Ports few fixes from lldpd master (#3889) 2019-12-18 11:19:55 -08:00
lm-sensors Fix the error that 'sensord' daemon cannot be spawn correctly in pmon container (#4354) 2020-04-06 17:13:00 -07:00
monit [monit] Build from source and patch to use MemAvailable value if available on system (#3875) 2020-01-06 11:41:20 -08:00
mpdecimal [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
ptf@36a3e3d9ac [docker-sonic-mgmt] install ptf framework in mgmt container and upgrade ptf (#3239) 2019-07-30 10:19:48 -07:00
python3 [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
python-click Build python-click Debian package from version 6.7-4 source to fix CLI autocomplete/suggest (#1824) 2018-06-29 09:59:46 -07:00
radvd [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
redis [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
redis-dump-load@832a645e4d Build patched redis-dump-load (#2277) 2018-11-20 19:27:56 -08:00
redis-dump-load.patch Build patched redis-dump-load (#2277) 2018-11-20 19:27:56 -08:00
sflow [sFlow]: Upgrade hsflowd to 2.0.26-1 (#3812) 2019-11-24 15:21:43 -08:00
smartmontools [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
snmpd Revert "Disable SNMPv1 (#2156)" (#4088) 2020-02-03 15:39:41 -08:00
socat [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00
sonic-bgpcfgd [bgpcfgd]: Change prefix-list generation for "Allow prefix" feature (#5639) 2020-10-30 08:56:52 -07:00
sonic-config-engine Everflow and Dataacl were getting binded to Backplane port-channels. (#5691) 2020-10-22 10:52:39 -07:00
sonic-dbsyncd@399ac217c6 [Submodule update] sonic-dbsyncd (#4801) 2020-06-20 08:09:38 -07:00
sonic-device-data [devices]: Fix the clock setting on arista 7280 (#3788) 2019-11-21 16:21:08 -08:00
sonic-frr Fix vrf test failed after frr update to 7.2 (#3763) 2020-05-27 07:11:23 +00:00
sonic-linux-kernel@6d10052a83 [kernel]: Update sonic-linux-kernel to pick up new fix (#5044) 2020-07-28 15:06:51 -07:00
sonic-mgmt-framework@e34d621cf7 [submodule]: update sonic-mgmt-framework (#5586) 2020-10-11 11:13:17 -07:00
sonic-platform-common@3ce77310a1 [Submodule update] sonic-platform-common 2020-10-06 11:24:05 -07:00
sonic-platform-daemons@419f05bf2a [Submodule update] sonic-platform-daemons 2020-10-21 08:16:12 -07:00
sonic-py-common [201911][sonic-py-common]: Fix syslog implicit min priority override (#5710) 2020-10-25 19:42:47 +02:00
sonic-py-swsssdk@99b91b319b [submodule] update sonic-py-swsssdk 2020-08-09 12:04:07 -07:00
sonic-quagga@0fa66a0210 Updated Submodule Commit. 2020-01-06 11:25:53 -08:00
sonic-restapi@37a7c616bc [Submodule] sonic-restapi (#5679) 2020-10-23 15:45:46 -07:00
sonic-sairedis@9092b5ae96 [submoule update] sonic-sairedis 2020-09-03 16:34:23 -07:00
sonic-snmpagent@1b005d3fdf [Submodule uupdate] sonic-snmpagent 2020-09-28 16:27:57 +00:00
sonic-swss@b27436501e [submodule update] sonic-swss 2020-10-21 08:19:28 -07:00
sonic-swss-common@c3a8f642c2 [Submodule update] sonic-swss-common 2020-09-19 15:28:12 -07:00
sonic-telemetry@01b53652e8 [201911][sonic-telemetry] Update submodule (#4987) 2020-07-17 17:37:21 -07:00
sonic-utilities@c2c4c0d7e4 [Submodule update] sonic-utilities 2020-10-21 08:25:18 -07:00
sonic-ztp@c93fb6d332 [sonic-ztp]: Update submodule pointer (#4902) 2020-07-06 22:36:30 -07:00
supervisor [build]: sonic arm64 changes (#3419) 2019-09-11 09:41:38 -07:00
swig [FRR]: Update frr to frr-7.0.1 (#2899) 2019-05-16 10:59:12 -07:00
systemd-sonic-generator [systemd-generator]: Remove creation of NUM_ASIC environment (#5122) 2020-08-19 15:06:04 -07:00
tacacs [build]: sonic arm64 changes (#3419) 2019-09-11 09:41:38 -07:00
thrift [build]: SONiC buildimage ARM arch support (#2980) 2019-07-25 22:06:41 -07:00