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

added null checks in configure_common_criteria_policy(aaa) #180

Conversation

adivardh-cisco
Copy link

@adivardh-cisco adivardh-cisco commented Sep 27, 2024

Fixes #179

uut.api.configure_common_criteria_policy(policy)

Error before changes:

2024-09-27T13:39:30: %AETEST-ERROR: Caught an exception while executing section configure_policy:
2024-09-27T13:39:30: %AETEST-ERROR: Traceback (most recent call last):
2024-09-27T13:39:30: %AETEST-ERROR:   File "/nobackup/adivardh/teacat_practice/user_missing.py", line 59, in configure_policy
2024-09-27T13:39:30: %AETEST-ERROR:     uut.api.configure_common_criteria_policy(policy)
2024-09-27T13:39:30: %AETEST-ERROR:   File "/nobackup/adivardh/pyats/lib/python3.8/site-packages/genie/conf/base/api.py", line 206, in wrapper_match
2024-09-27T13:39:30: %AETEST-ERROR:     func_result = func(*args, **kwargs)
2024-09-27T13:39:30: %AETEST-ERROR:   File "/nobackup/adivardh/pyats/lib/python3.8/site-packages/genie/libs/sdk/apis/iosxe/aaa/configure.py", line 924, in configure_common_criteria_policy
2024-09-27T13:39:30: %AETEST-ERROR:     if int(lower_case) > 0:
2024-09-27T13:39:30: %AETEST-ERROR: TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

After the changes:

2024-09-27 13:44:40,146: %UNICON-INFO: +++ Router(alias=uut) with via 'a': configure +++
config term
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#aaa common-criteria policy POLICY
Router(config-cc-policy)#end
Router#

@adivardh-cisco adivardh-cisco requested a review from a team as a code owner September 27, 2024 08:22
@adivardh-cisco adivardh-cisco force-pushed the aaa-create-common-criteria-policy branch from 9cebd92 to 8d37e85 Compare September 27, 2024 14:10
@adivardh-cisco
Copy link
Author


(pyATS) bgl-ads-20083:/nobackup/adivardh/genie_fork/genielibs/pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/aaa/configure/configure_common_criteria_policy > python -m unittest

2024-09-27 20:39:18,784: %UNICON-INFO: +++ VTP-PK1 logfile /tmp/VTP-PK1-cli-20240927T203918784.log +++

2024-09-27 20:39:18,784: %UNICON-INFO: +++ Unicon plugin iosxe/cat9k (unicon.internal.plugins.iosxe.cat9k) +++
/nobackup/adivardh/pyATS/lib/python3.8/site-packages/unicon/bases/routers/connection.py:97: DeprecationWarning: Arguments 'username', 'enable_password','tacacs_password' and 'line_password' are now deprecated and replaced by 'credentials'.
  warnings.warn(message = "Arguments 'username', "
Trying mock_device ...
Connected to mock_device.
Escape character is '^]'.


2024-09-27 20:39:19,492: %UNICON-INFO: +++ connection to spawn: mock_device_cli --os iosxe --mock_data_dir mock_data --state connect, id: 140612660653264 +++

2024-09-27 20:39:19,492: %UNICON-INFO: connection to VTP-PK1

VTP-PK1#

2024-09-27 20:39:21,091: %UNICON-INFO: Learned hostname(s): 'VTP-PK1'.

VTP-PK1#

2024-09-27 20:39:21,241: %UNICON-INFO: +++ VTP-PK1 with via 'a': executing command 'show version | include operating mode' +++
show version | include operating mode
VTP-PK1#

2024-09-27 20:39:21,364: %UNICON-INFO: +++ initializing handle +++

2024-09-27 20:39:21,365: %UNICON-INFO: Learned hostname(s): 'VTP-PK1'.

2024-09-27 20:39:21,487: %UNICON-INFO: +++ VTP-PK1 with via 'a': configure +++
config term
VTP-PK1(config)#aaa common-criteria policy ABCD
aaa common-criteria policy ABCD
VTP-PK1(config)#char-changes 5
char-changes 5
VTP-PK1(config)#lower-case 1
lower-case 1
VTP-PK1(config)#upper-case 1
upper-case 1
VTP-PK1(config)#max-length 20
max-length 20
VTP-PK1(config)#min-length 8
min-length 8
VTP-PK1(config)#numeric-count 1
numeric-count 1
VTP-PK1(config)#special-case 1
special-case 1
VTP-PK1(config)#character-repetition 5
character-repetition 5
VTP-PK1(config)#restrict-consecutive-letters
restrict-consecutive-letters
VTP-PK1(config)#end
VTP-PK1#
.
2024-09-27 20:39:21,651: %UNICON-INFO: +++ Router logfile /tmp/Router-cli-20240927T203921651.log +++

2024-09-27 20:39:21,652: %UNICON-INFO: +++ Unicon plugin iosxe (unicon.internal.plugins.iosxe) +++
Trying mock_device ...
Connected to mock_device.
Escape character is '^]'.


2024-09-27 20:39:22,407: %UNICON-INFO: +++ connection to spawn: mock_device_cli --os iosxe --mock_data_dir /nobackup/adivardh/genie_fork/genielibs/pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/aaa/configure/configure_common_criteria_policy/mock_data --state connect, id: 140612661013664 +++

2024-09-27 20:39:22,407: %UNICON-INFO: connection to Router

VTP-PK1#

2024-09-27 20:39:23,990: %UNICON-INFO: Learned hostname(s): 'VTP-PK1'.

VTP-PK1#

2024-09-27 20:39:24,144: %UNICON-INFO: +++ VTP-PK1(alias=Router) with via 'a': executing command 'show version | include operating mode' +++
show version | include operating mode
VTP-PK1#

2024-09-27 20:39:24,266: %UNICON-INFO: +++ initializing handle +++

2024-09-27 20:39:24,388: %UNICON-INFO: +++ VTP-PK1(alias=Router) with via 'a': configure +++
config term
VTP-PK1(config)#aaa common-criteria policy ABCD
aaa common-criteria policy ABCD
VTP-PK1(config)#end
VTP-PK1#
.
----------------------------------------------------------------------
Ran 2 tests in 6.663s

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Common Criteria Policy optional arguments missing null checks
1 participant