Skip to content

Commit

Permalink
Add LDAP feature CLI support (#3022)
Browse files Browse the repository at this point in the history
- What I did
Add LDAP CLI

- How I did it
created the CLI by using YANG model generator, the YANG model can be found in the LDAP HLD:
sonic-net/SONiC#1487

- How to verify it
Manually:
you can use configurations command like"config ldap global " or
"show ldap global" (more examples in the HLD.)
Auto:
1.There are unitest of each policy including good & bad flow in this commit, that should pass.
  • Loading branch information
davidpil2002 authored May 15, 2024
1 parent 550816b commit 2fda252
Show file tree
Hide file tree
Showing 8 changed files with 789 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/aaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def trace(option):


@click.command()
@click.argument('auth_protocol', nargs=-1, type=click.Choice(["radius", "tacacs+", "local", "default"]))
@click.argument('auth_protocol', nargs=-1, type=click.Choice(["ldap", "radius", "tacacs+", "local", "default"]))
def login(auth_protocol):
"""Switch login authentication [ {radius, tacacs+, local} | default ]"""
"""Switch login authentication [ {ldap, radius, tacacs+, local} | default ]"""
if len(auth_protocol) is 0:
click.echo('Argument "auth_protocol" is required')
return
Expand All @@ -135,9 +135,9 @@ def login(auth_protocol):
val2 = auth_protocol[1]
good_ap = False
if val == 'local':
if val2 == 'radius' or val2 == 'tacacs+':
if val2 == 'radius' or val2 == 'tacacs+' or val2 == 'ldap':
good_ap = True
elif val == 'radius' or val == 'tacacs+':
elif val == 'radius' or val == 'tacacs+' or val == 'ldap':
if val2 == 'local':
good_ap = True
if good_ap == True:
Expand Down
Loading

0 comments on commit 2fda252

Please sign in to comment.