Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more bgp config schema and add increment config #2355

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

batmancn
Copy link

@batmancn batmancn commented Dec 6, 2018

** What I did **

Now BGP config shema have some limitation: only support BGP asn and BGP neighbor and its increment config.

To use SONiC in more scenes

  1. I create or add more schema into BGP config like these:
    BGP_PEER_RANGE, VLAN_INTERFACE, INTERFACE, LOOPBACK_INTERFACE, BGP_METADATA, STATIC_ROUTE, BGP_AS_SET, BGP_COMMUNITY_SET, BGP_POLICY_ROUTE_MAP, BGP_PREFIX_SET, IP_ACCESS_LIST.

  2. I add increment config method associate with schemas above.

  3. I add retain route feature into config file of quagga.

  4. I add "del" opcode for handler function in bgpcfgd, which could verify "add" or "del" of config converted from CONFIG DB of redis, refer to: add opcode for notification of redis DB sonic-py-swsssdk#42

** Detail of these shema **

Most of these schema bellow support increment config.
All of increment config support add/delete.
Some of increment config support update, like static route.

  1. BGP asn(this is original repo code):
    {
    "DEVICE_METADATA": {
    "localhost": {
    "bgp_asn": "5001"
    }
    }
    }

  2. BGP neighbor:
    {
    "BGP_NEIGHBOR": {
    "192.168.1.10": {
    "admin_status": "up",
    "asn": "5001",
    "name": "test",
    "local_addr": "192.168.1.20",
    "policy_in": "BGP_POLICY_NAME_1|BGP_POLICY_NAME_2|BGP_POLICY_NAME_3|BGP_POLICY_NAME_4",
    "policy_out": "BGP_POLICY_NAME_1|BGP_POLICY_NAME_2",
    "policy_import": "BGP_POLICY_NAME_1|BGP_POLICY_NAME_2|BGP_POLICY_NAME_3|BGP_POLICY_NAME_4",
    "policy_export": "BGP_POLICY_NAME_1|BGP_POLICY_NAME_2",
    "remote_as": "20",
    "description": "DESCRIPTION",
    "password": "PASSWORD",
    "ebgp_multihop": "64",
    "maximum_paths": "64",
    "prefix_in": "BGP_PREFIX_SET_NAME_1|BGP_PREFIX_SET_NAME_2",
    "prefix_out": "BGP_PREFIX_SET_NAME_1|BGP_PREFIX_SET_NAME_2"
    }
    }
    }

Add BGP policy, remote as, password, eBGP multihop, maximun path, prefix list config.
Detail of these config is bellow.

  1. BGP network for vlan, loopback, L3 interface:
    {
    "VLAN": {
    "Vlan3998": {
    "vlanid": "3998"
    }
    },
    "LOOPBACK_INTERFACE": {
    "Loopback1|10.18.0.32/32": {}
    },
    "VLAN_INTERFACE": {
    "Vlan3998|100.8.1.2/24": {}
    }
    }

Add L3 interface IP to advertise in BGP using network command in quagga.
Add "del" opcode to verify add or delete operate, refer to: sonic-net/sonic-py-swsssdk#42

  1. static route, redistribute:
    STATIC_ROUTE: {
    "dst_ip:1.1.1.1/24|nexthop:1.1.1.2": {
    "metric": "30"
    }
    },
    BGP_METADATA: {
    "localhost": {
    "redistribute": "static"
    }
    }

  2. BGP neighbor peer group:
    {
    "BGP_NEIGHBOR": {
    BGP_NEIGHBOR_PEER_GROUP_NAME: {
    "admin_status": "up",
    "asn": "5002",
    "name": "peergroup1",
    "local_addr": "192.168.1.20"
    },
    "12.12.12.12": {
    "peer_group": BGP_NEIGHBOR_PEER_GROUP_NAME
    }
    }
    }

  3. ip as-path access-list:
    {
    "BGP_AS_SET": {
    "as_path_1": {
    "description": "as_path_1",
    "action": "permit",
    "line": "^3356$ _65101$"
    }
    }
    }

  4. ip community-list:
    {
    "BGP_COMMUNITY_SET": {
    "community_1" : {
    "description": "community_1",
    "line": "7675:70 7675:80 7675:60",
    "action": "deny"
    }
    }
    }

  5. ip prefix-list:
    {
    "BGP_PREFIX_SET": {
    "0.0.0.0/0|CU_IN|deny": {
    "description": "CU_IN",
    "compare": "le",
    "length": "32",
    "seq": "5"
    }
    }
    }

  6. route-map:
    {
    "BGP_POLICY_ROUTE_MAP": {
    "bgp_policy_1|deny|20": {
    "description": "I am description",
    "match_as_path": "as_path_1",
    "set_as_path": "1"
    },
    "bgp_policy_1|deny|21": {
    "match_prefix_list": "ipv6|match_prefix_list_ipv6_name",
    "set_metric": "10"
    },
    "bgp_policy_1|deny|22": {
    "match_prefix_list": "ipv6|match_prefix_list_ipv6_name",
    "set_community": "4567:10"
    },
    "bgp_policy_1|deny|23": {
    "match_prefix_list": "ipv6|match_prefix_list_ipv6_name",
    "set_local_preference": "10"
    },
    "bgp_policy_1|deny|24": {
    "match_prefix_list": "ipv6|match_prefix_list_ipv6_name",
    "set_ip_next_hop": "127.0.0.1"
    }
    }
    }

  7. access-list:
    {
    "IP_ACCESS_LIST": {
    "filter|deny 1.2.1.2/24 exact-match": {},
    "filter|permit 2.1.2.1/24": {},
    "filter|remark 2424:24 3232:32": {}
    }
    }
    }

  8. graceful-restart:
    {
    "BGP_METADATA": {
    "localhost": {
    "graceful_restart_param": "restart-time 120|stalepath-time 360"
    }
    }
    }

this is for user define gr capacity, not support increment config.

  1. maximun-path:
    {
    "BGP_METADATA": {
    "localhost": {
    "maximum_paths": "30"
    }
    }
    }

this is for user define maximum, not support increment config.

** Test cases **

I add test json file here: https://github.com/batmancn/sonic-buildimage/tree/testcase_of_bgp_config_schema_enhance_and_increment_config/dockers/docker-fpm-quagga/unit_test

You could test functions above by bash bgp_test.sh or frr_test.sh.

** issues **

  1. static route schema is now same as Add static route #1848

@jipanyang
Copy link
Collaborator

The transition of taking FRR as the default routing stack probably will be done in sonic March release of next year, will it make sense to support FRR too? Or even take FRR support as the priority?

@batmancn batmancn force-pushed the bgp_config_schema_enhance_and_increment_config branch from ae1355b to 3efab1b Compare December 6, 2018 07:47
@batmancn
Copy link
Author

batmancn commented Dec 6, 2018

The transition of taking FRR as the default routing stack probably will be done in sonic March release of next year, will it make sense to support FRR too? Or even take FRR support as the priority?

I will have a look at this, and report here.
I want to know detail plan of "replace QUAGGA by FRR", like why do this, how do this, etc. If there are some proposal or design spec or something.

@jipanyang
Copy link
Collaborator

I will have a look at this, and report here.
I want to know detail plan of "replace QUAGGA by FRR", like why do this, how do this, etc. If there are some proposal or design spec or something.

I think @zhenggen-xu @rodnymolina @nikos-github have been handling FRR related work, probably they could answer your questions better.

@rodnymolina
Copy link
Contributor

@batmancn Simon, as you may know, most of the SONiC<->FRR integration work has been already done over the last couple of years. You can easily build an FRR-based sonic image by simply changing the ROUTE_STACK knob present in rules/config file. At this point only minor items are pending, such as double-checking that the existing Quagga jinja templates are fully compliant with FRR (which they mostly are), and update SONiC's testing framework to deal with potential CLI differences between Quagga and FRR.

I agree with @jipanyang suggestion of extending your PR to FRR's routing-stack.

@batmancn
Copy link
Author

batmancn commented Dec 7, 2018

FRR

The "extending your PR to FRR's routing-stack" is also I need to do in my environment, I will have a look at this.

I will pay attention on discuss/design spec/proposal/... of QUAGGA<->FRR. And I will search these, it's thankful if someone tell these to me.

@zhenggen-xu
Copy link
Collaborator

zhenggen-xu commented Dec 7, 2018

@batmancn Please take a look at this PR for some details about the FRR support: #2099

High level the reason we want to move to FRR is that it has a more active community, and has the features we need on SONiC roadmap etc.

If you can extend the template to FRR, that would be great.

Ansible framework changes were also upstreamed to sonic-mgmt repo. The default stack is quagga on github but internally we have done the ansible tests without any problem at the time the PR was submitted.

@batmancn
Copy link
Author

batmancn commented Dec 7, 2018

@batmancn Please take a look at this PR for some details about the FRR support: #2099

High level the reason we want to move to FRR is that it has a more active community, and has the features we need on SONiC roadmap etc.

If you can extend the template to FRR, that would be great.

Ansible framework changes were also upstreamed to sonic-mgmt repo. The default stack is quagga on github but internally we have done the ansible tests without any problem at the time the PR was submitted.

OK, thank you.

The last, you mean testcase of mgmt repo is worked on FRR, that's great.

@batmancn
Copy link
Author

I have added frr increment config feature by moving these code to sonic-frr, refer to this commit "ac574f86" on branch "bgp_config_schema_enhance_and_increment_config".

These code has been tested by the same way described in 1st conversation "Test cases" section, by "frr_test.sh" script.

@pavel-shirshov pavel-shirshov self-assigned this Oct 15, 2019
yxieca added a commit to yxieca/sonic-buildimage that referenced this pull request Sep 9, 2022
…x-kernel] advance submodule head

linkmgrd:
* ab5b2c1 2022-09-02 | Fix mux config (sonic-net#128) (HEAD -> 202205, github/202205) [Longxiang Lyu]

utilities:
* 7de9305 2022-09-07 | [generate dump]Added error message when saisdkdump fails (sonic-net#2356) (HEAD -> 202205, github/202205) [Sudharsan Dhamal Gopalarathnam]
* c5b0a6d 2022-09-07 | [counterpoll]Fixing counterpoll show for tunnel and acl stats (sonic-net#2355) [Sudharsan Dhamal Gopalarathnam]
* 1452b44 2022-09-05 | [GCU] Fix missing backend in dry run (sonic-net#2347) [jingwenxie]
* bc7b845 2022-09-04 | Add Password Hardening CLI support (sonic-net#2338) [davidpil2002]
* 55e8948 2022-09-06 | [fast-reboot]Avoid stopping masked services during fast-reboot (sonic-net#2335) [Sudharsan Dhamal Gopalarathnam]
* f7d69d4 2022-08-30 | Replace cmp in acl_loader with operator.eq (sonic-net#2328) [Zhaohui Sun]
* 4054ebb 2022-09-05 | Add verification for override (sonic-net#2305) [jingwenxie]
* 729d811 2022-05-30 | Fix sonic-installer and 'show version' command crash when database docker not running issue. (sonic-net#2183) [Hua Liu]

platform-daemons:
* 36ba7c0 2022-09-07 | [ycable] cleanup logic for creating grpc future ready (sonic-net#289) (HEAD -> 202205) [vdahiya12]
* 2a9db73 2022-09-01 | [ycabled] fix insert events from xcvrd;cleanup some mux toggle logic (sonic-net#287) [vdahiya12]

platform-common:
* d7c990d 2022-09-03 | [CMIS] 'get_transceiver_info' should return 'None' when CMIS cable EEPROM is not ready  (sonic-net#305) (HEAD -> 202205) [Kebo Liu]

linux-kernel:
* 25ea052 2022-08-31 | [patch]: Add accpt_untracked_na kernel param (sonic-net#292) (HEAD -> 202205) [Lawrence Lee]

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
yxieca added a commit that referenced this pull request Sep 10, 2022
…x-kernel] advance submodule head (#12025)

linkmgrd:
* ab5b2c1 2022-09-02 | Fix mux config (#128) (HEAD -> 202205, github/202205) [Longxiang Lyu]

utilities:
* 7de9305 2022-09-07 | [generate dump]Added error message when saisdkdump fails (#2356) (HEAD -> 202205, github/202205) [Sudharsan Dhamal Gopalarathnam]
* c5b0a6d 2022-09-07 | [counterpoll]Fixing counterpoll show for tunnel and acl stats (#2355) [Sudharsan Dhamal Gopalarathnam]
* 1452b44 2022-09-05 | [GCU] Fix missing backend in dry run (#2347) [jingwenxie]
* bc7b845 2022-09-04 | Add Password Hardening CLI support (#2338) [davidpil2002]
* 55e8948 2022-09-06 | [fast-reboot]Avoid stopping masked services during fast-reboot (#2335) [Sudharsan Dhamal Gopalarathnam]
* f7d69d4 2022-08-30 | Replace cmp in acl_loader with operator.eq (#2328) [Zhaohui Sun]
* 4054ebb 2022-09-05 | Add verification for override (#2305) [jingwenxie]
* 729d811 2022-05-30 | Fix sonic-installer and 'show version' command crash when database docker not running issue. (#2183) [Hua Liu]

platform-daemons:
* 36ba7c0 2022-09-07 | [ycable] cleanup logic for creating grpc future ready (#289) (HEAD -> 202205) [vdahiya12]
* 2a9db73 2022-09-01 | [ycabled] fix insert events from xcvrd;cleanup some mux toggle logic (#287) [vdahiya12]

platform-common:
* d7c990d 2022-09-03 | [CMIS] 'get_transceiver_info' should return 'None' when CMIS cable EEPROM is not ready  (#305) (HEAD -> 202205) [Kebo Liu]

linux-kernel:
* 25ea052 2022-08-31 | [patch]: Add accpt_untracked_na kernel param (#292) (HEAD -> 202205) [Lawrence Lee]

Signed-off-by: Ying Xie <ying.xie@microsoft.com>

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
dgsudharsan added a commit to dgsudharsan/sonic-buildimage that referenced this pull request Sep 14, 2022
Update sonic-utilities submodule pointer to include the following:
* 4d377a6 [subinterface]Added additional checks in portchannel and subinterface commands ([sonic-net#2345](sonic-net/sonic-utilities#2345))
* bbcdf2e disk_check: Publish event  for RO state ([sonic-net#2320](sonic-net/sonic-utilities#2320))
* 3fd537b Support the bandit check by GitHub Action ([sonic-net#2358](sonic-net/sonic-utilities#2358))
* 491d3d3 [generate dump]Added error message when saisdkdump fails ([sonic-net#2356](sonic-net/sonic-utilities#2356))
* 6830e01 [counterpoll]Fixing counterpoll show for tunnel and acl stats ([sonic-net#2355](sonic-net/sonic-utilities#2355))
* 3be2ad7 [fast-reboot]Avoid stopping masked services during fast-reboot ([sonic-net#2335](sonic-net/sonic-utilities#2335))
* 0e1b0cf [GCU] Fix missing backend in dry run ([sonic-net#2347](sonic-net/sonic-utilities#2347))
* 676c31b Add verification for override ([sonic-net#2305](sonic-net/sonic-utilities#2305))
* 48997c2 Add Password Hardening CLI support ([sonic-net#2338](sonic-net/sonic-utilities#2338))
* 414e239 update unit tests for swap ([#locato](https://github.com/Azure/sonic-utilities/pull/locato))
* a91a492 consider swap checking memory in ([#stalle](https://github.com/Azure/sonic-utilities/pull/stalle))
* f0ce586 [route_check]: Ignore standalone tunnel routes ([sonic-net#2325](sonic-net/sonic-utilities#2325))

Signed-off-by: dgsudharsan <sudharsand@nvidia.com>
dprital added a commit to dprital/sonic-buildimage that referenced this pull request Sep 21, 2022
Update sonic-utilities submodule pointer to include the following:
* 0a7557b [minigraph] add option to specify golden path in load_minigraph ([sonic-net#2350](sonic-net/sonic-utilities#2350))
* 322aefc [GCU]Remove GCU unique lane check for duplicate lanes platforms ([sonic-net#2343](sonic-net/sonic-utilities#2343))
* 7099fff [fastboot] fastboot enhancement: Use warm-boot infrastructure for fast-boot ([sonic-net#2286](sonic-net/sonic-utilities#2286))
* 09026ed [warm-reboot] fix warm-reboot when /tmp/cache is missing ([sonic-net#2367](sonic-net/sonic-utilities#2367))
* a3c404c Fix typo in platform_sfputil_helper.is_rj45_port ([sonic-net#2374](sonic-net/sonic-utilities#2374))
* 637d834 Vnet_route_check Vxlan tunnel route update. ([sonic-net#2281](sonic-net/sonic-utilities#2281))
* 29a3e51 Added support for tunnel route status in show vnet routes all. ([sonic-net#2341](sonic-net/sonic-utilities#2341))
* 1ac584b Use 'default' VRF when VRF name is not provided ([sonic-net#2368](sonic-net/sonic-utilities#2368))
* 4d377a6 [subinterface]Added additional checks in portchannel and subinterface commands ([sonic-net#2345](sonic-net/sonic-utilities#2345))
* bbcdf2e disk_check: Publish event  for RO state ([sonic-net#2320](sonic-net/sonic-utilities#2320))
* 3fd537b Support the bandit check by GitHub Action ([sonic-net#2358](sonic-net/sonic-utilities#2358))
* 491d3d3 [generate dump]Added error message when saisdkdump fails ([sonic-net#2356](sonic-net/sonic-utilities#2356))
* 6830e01 [counterpoll]Fixing counterpoll show for tunnel and acl stats ([sonic-net#2355](sonic-net/sonic-utilities#2355))
* 3be2ad7 [fast-reboot]Avoid stopping masked services during fast-reboot ([sonic-net#2335](sonic-net/sonic-utilities#2335))
* 0e1b0cf [GCU] Fix missing backend in dry run ([sonic-net#2347](sonic-net/sonic-utilities#2347))
* 676c31b Add verification for override ([sonic-net#2305](sonic-net/sonic-utilities#2305))
* 48997c2 Add Password Hardening CLI support ([sonic-net#2338](sonic-net/sonic-utilities#2338))
* 414e239 update unit tests for swap ([#locato](https://github.com/sonic-net/sonic-utilities/pull/locato))
* a91a492 consider swap checking memory in ([#stalle](https://github.com/sonic-net/sonic-utilities/pull/stalle))
* f0ce586 [route_check]: Ignore standalone tunnel routes ([sonic-net#2325](sonic-net/sonic-utilities#2325))

Signed-off-by: dprital <drorp@nvidia.com>
@wen587 wen587 mentioned this pull request Sep 23, 2022
7 tasks
qiluo-msft pushed a commit that referenced this pull request Oct 1, 2022
0a7557bd9 [minigraph] add option to specify golden path in load_minigraph (#2350)
322aefc37 [GCU]Remove GCU unique lane check for duplicate lanes platforms (#2343)
7099fffa7 [fastboot] fastboot enhancement: Use warm-boot infrastructure for fast-boot (#2286)
09026edbb [warm-reboot] fix warm-reboot when /tmp/cache is missing (#2367)
a3c404c74 Fix typo in platform_sfputil_helper.is_rj45_port (#2374)
637d834ce Vnet_route_check Vxlan tunnel route update. (#2281)
29a3e5180 Added support for tunnel route status in show vnet routes all. (#2341)
1ac584bb3 Use 'default' VRF when VRF name is not provided (#2368)
4d377a620 [subinterface]Added additional checks in portchannel and subinterface commands (#2345)
bbcdf2ed7 disk_check: Publish event  for RO state (#2320)
3fd537b0a Support the bandit check by GitHub Action (#2358)
491d3d380 [generate dump]Added error message when saisdkdump fails (#2356)
6830e01ec [counterpoll]Fixing counterpoll show for tunnel and acl stats (#2355)
3be2ad7de [fast-reboot]Avoid stopping masked services during fast-reboot (#2335)
0e1b0cf20 [GCU] Fix missing backend in dry run (#2347)
676c31bd0 Add verification for override (#2305)
48997c266 Add Password Hardening CLI support (#2338)
414e239ea update unit tests for swap allocator
a91a4922f consider swap checking memory in installer
f0ce58635 [route_check]: Ignore standalone tunnel routes (#2325)
roberthong-qct pushed a commit to QuantaSwitch/sonic-buildimage that referenced this pull request Nov 18, 2022
0a7557bd9 [minigraph] add option to specify golden path in load_minigraph (sonic-net#2350)
322aefc37 [GCU]Remove GCU unique lane check for duplicate lanes platforms (sonic-net#2343)
7099fffa7 [fastboot] fastboot enhancement: Use warm-boot infrastructure for fast-boot (sonic-net#2286)
09026edbb [warm-reboot] fix warm-reboot when /tmp/cache is missing (sonic-net#2367)
a3c404c74 Fix typo in platform_sfputil_helper.is_rj45_port (sonic-net#2374)
637d834ce Vnet_route_check Vxlan tunnel route update. (sonic-net#2281)
29a3e5180 Added support for tunnel route status in show vnet routes all. (sonic-net#2341)
1ac584bb3 Use 'default' VRF when VRF name is not provided (sonic-net#2368)
4d377a620 [subinterface]Added additional checks in portchannel and subinterface commands (sonic-net#2345)
bbcdf2ed7 disk_check: Publish event  for RO state (sonic-net#2320)
3fd537b0a Support the bandit check by GitHub Action (sonic-net#2358)
491d3d380 [generate dump]Added error message when saisdkdump fails (sonic-net#2356)
6830e01ec [counterpoll]Fixing counterpoll show for tunnel and acl stats (sonic-net#2355)
3be2ad7de [fast-reboot]Avoid stopping masked services during fast-reboot (sonic-net#2335)
0e1b0cf20 [GCU] Fix missing backend in dry run (sonic-net#2347)
676c31bd0 Add verification for override (sonic-net#2305)
48997c266 Add Password Hardening CLI support (sonic-net#2338)
414e239ea update unit tests for swap allocator
a91a4922f consider swap checking memory in installer
f0ce58635 [route_check]: Ignore standalone tunnel routes (sonic-net#2325)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants