-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Junos fix next-hop self in get_bgp_config() (#620)
* junos fix nhs in get_bgp_config() * junos add test case for nhs in get_bgp_config() * junos fix missing policy in existing test case for nhs * junos fix E712 comparison * fix typo * junos remove nhs key in group level in get_bgp_config() * junos rework nhs in get_bgp_config() by fetching all policies in one go * junos fix test case for nhs get_bgp_config() * junos clean code and add comments in nhs get_bgp_config() * junos nhs remove inactive term in mocked data
- Loading branch information
1 parent
a5255d0
commit 7ad5e6a
Showing
6 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...s/_configuration__policy_options__policy_statement____policy_options___configuration_.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<configuration> | ||
<policy-options> | ||
<policy-statement> | ||
<name>PUBLIC-PEER-OUT</name> | ||
<then> | ||
<next-hop> | ||
<self/> | ||
</next-hop> | ||
<accept/> | ||
</then> | ||
</policy-statement> | ||
<policy-statement> | ||
<name>nhs</name> | ||
<term> | ||
<name>0</name> | ||
<then> | ||
<accept/> | ||
</then> | ||
</term> | ||
<then> | ||
<next-hop> | ||
<self/> | ||
</next-hop> | ||
</then> | ||
</policy-statement> | ||
<policy-statement> | ||
<name>nhs2</name> | ||
<then> | ||
<next-hop> | ||
<self/> | ||
</next-hop> | ||
</then> | ||
</policy-statement> | ||
<policy-statement> | ||
<name>nhs3</name> | ||
<term> | ||
<name>1</name> | ||
<then> | ||
<accept/> | ||
</then> | ||
</term> | ||
<term> | ||
<name>2</name> | ||
<then> | ||
<next>term</next> | ||
</then> | ||
</term> | ||
<term> | ||
<name>3</name> | ||
<then> | ||
<reject/> | ||
</then> | ||
</term> | ||
<term> | ||
<name>4</name> | ||
<then> | ||
<next-hop> | ||
<peer-address/> | ||
</next-hop> | ||
</then> | ||
</term> | ||
<then> | ||
<next-hop> | ||
<self/> | ||
</next-hop> | ||
</then> | ||
</policy-statement> | ||
<policy-statement> | ||
<name>static</name> | ||
<term> | ||
<name>1</name> | ||
<from> | ||
<protocol>static</protocol> | ||
</from> | ||
<then> | ||
<accept/> | ||
</then> | ||
</term> | ||
</policy-statement> | ||
<community> | ||
<name>target</name> | ||
<members>6500:1</members> | ||
</community> | ||
<community> | ||
<name>vrf-target</name> | ||
<members>target:65000:1</members> | ||
</community> | ||
</policy-options> | ||
</configuration> | ||
|
25 changes: 25 additions & 0 deletions
25
..._config/nhs/_configuration__protocols__bgp__group____bgp___protocols___configuration_.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<configuration> | ||
<protocols> | ||
<bgp> | ||
<local-as> | ||
<as-number>65001</as-number> | ||
</local-as> | ||
<group> | ||
<name>internal</name> | ||
<type>internal</type> | ||
<neighbor> | ||
<name>10.10.10.1</name> | ||
<export>nhs</export> | ||
</neighbor> | ||
</group> | ||
<group> | ||
<name>internal-2</name> | ||
<type>internal</type> | ||
<neighbor> | ||
<name>10.10.10.2</name> | ||
<export>static</export> | ||
</neighbor> | ||
</group> | ||
</bgp> | ||
</protocols> | ||
</configuration> |
1 change: 1 addition & 0 deletions
1
test/junos/mocked_data/test_get_bgp_config/nhs/expected_result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"internal":{"apply_groups":[],"description":"","export_policy":"","import_policy":"","local_address":"","local_as":0,"multihop_ttl":0,"multipath":false,"neighbors":{"10.10.10.1":{"authentication_key":"","description":"","export_policy":"nhs","import_policy":"","local_address":"","local_as":0,"nhs":true,"prefix_limit":{},"remote_as":0,"route_reflector_client":false}},"prefix_limit":{},"remote_as":0,"remove_private_as":false,"type":"internal"},"internal-2":{"apply_groups":[],"description":"","export_policy":"","import_policy":"","local_address":"","local_as":0,"multihop_ttl":0,"multipath":false,"neighbors":{"10.10.10.2":{"authentication_key":"","description":"","export_policy":"static","import_policy":"","local_address":"","local_as":0,"nhs":false,"prefix_limit":{},"remote_as":0,"route_reflector_client":false}},"prefix_limit":{},"remote_as":0,"remove_private_as":false,"type":"internal"}} |
18 changes: 18 additions & 0 deletions
18
...l/_configuration__policy_options__policy_statement____policy_options___configuration_.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<configuration> | ||
<policy-options> | ||
<policy-statement> | ||
<name>PUBLIC-PEER-IN</name> | ||
<then> | ||
<accept/> | ||
</then> | ||
</policy-statement> | ||
</policy-options> | ||
<policy-options> | ||
<policy-statement> | ||
<name>PUBLIC-PEER-OUT</name> | ||
<then> | ||
<accept/> | ||
</then> | ||
</policy-statement> | ||
</policy-options> | ||
</configuration> |