Skip to content

Commit

Permalink
Update sys auth mode from integer to string (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag6 authored Oct 19, 2021
1 parent e340a60 commit 1d49d5a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions etc/test_access.out
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Starting varz-vlan-assigned test...
3.0
4.0
4.0
auth_mode="all"

200.0
%%% port-down
Starting dva-port-down tests
Expand Down Expand Up @@ -90,6 +92,8 @@ Starting varz-port-down test...
3.0
4.0
0.0
auth_mode="all"

200.0
%%% port-up
Starting dva-port-up tests
Expand Down Expand Up @@ -132,6 +136,8 @@ Starting varz-port-up test...
3.0
4.0
4.0
auth_mode="all"

200.0
%%% mac-flipped
Starting dva-mac-flipped tests
Expand Down Expand Up @@ -174,6 +180,8 @@ Starting varz-mac-flipped test...
3.0
4.0
0.0
auth_mode="all"

200.0
%%% negative
Radius results 0 1 1 1
3 changes: 1 addition & 2 deletions forch/forch_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ def _add_vars(self):
labels=['mac'])

self._add_var(
'system_initialization', 'Initialization state of the system', Gauge,
labels=['auth_mode'])
'system_initialization', 'Initialization state of the system', Info)

def get_metrics(self, path, params):
"""Return metric list in printable form"""
Expand Down
4 changes: 2 additions & 2 deletions forch/forchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,8 @@ def update_initialization_varz(self):
if not self._metrics:
return

sys_auth_mode = self._get_sys_auth_mode()
self._metrics.update_var('system_initialization', self._initialized, [sys_auth_mode])
sys_auth_mode = AuthMode.Mode.Name(self._get_sys_auth_mode())
self._metrics.update_var('system_initialization', {'auth_mode': sys_auth_mode})

def cleanup(self):
"""Clean up relevant internal data in all collectors"""
Expand Down
1 change: 1 addition & 0 deletions testing/test_access
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function test_forch_varz {
grep 'device_state' <<< $metrics | grep '9a:02:57:1e:8f:01' | awk '{print $2}' | tee -a $TEST_RESULTS
grep 'device_state' <<< $metrics | grep '9a:02:57:1e:8f:02' | awk '{print $2}' | tee -a $TEST_RESULTS
grep 'device_state' <<< $metrics | grep '9a:02:57:1e:8f:03' | awk '{print $2}' | tee -a $TEST_RESULTS
grep 'system_initialization' <<< $metrics | awk -vRS="}" -vFS="{" '{print $2}' | tee -a $TEST_RESULTS

grep 'static_mac_vlan' <<< $metrics | grep '9a:02:57:1e:8f:01' | awk '{print $2}' | tee -a $TEST_RESULTS
}
Expand Down

0 comments on commit 1d49d5a

Please sign in to comment.