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

T5013: Extend accelppp op-mode script to get statistic #1829

Merged
merged 2 commits into from
Feb 23, 2023

Conversation

sever-sever
Copy link
Member

Change Summary

Extend accelppp.py op-mode script to get
subnet/start/stop/gateway/client_ip_pool/ etc
info from the configuration

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe): Extend accelppp raw data

Related Task(s)

Component(s) name

Proposed changes

How to test

vyos@r14:~$ /usr/libexec/vyos/op_mode/accelppp.py show_statistics --protocol l2tp --raw
{
    "sessions": {
        "active": "0",
        "starting": "0"
    },
    "cpu": "0%",
    "config_option": {
        "authentication": {
            "mode": "local"
        },
        "client_ip_pool": {
            "subnet": [
                "100.64.45.0/24"
            ]
        }
    }
}

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Extend accelppp.py op-mode script to get
subnet/start/stop/gateway/client_ip_pool/ etc
info from the configuration
@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro and c-po and removed request for a team February 18, 2023 09:43
Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"cpu": "0%",

I believe we should reflect units in the field name, not in the value. With 10%, if a client wants to display a progress bar, it needs to remove the percent sign from the string and convert the string to integer.

Something like cpu_load_percentage: 10 is both descriptive and directly usable.

@sever-sever
Copy link
Member Author

"cpu": "0%",

I believe we should reflect units in the field name, not in the value. With 10%, if a client wants to display a progress bar, it needs to remove the percent sign from the string and convert the string to integer.

Something like cpu_load_percentage: 10 is both descriptive and directly usable.

It was there before, I just extended the dict with config_option

    "config_option": {
        "authentication": {
            "mode": "local"
        },
        "client_ip_pool": {
            "subnet": [
                "100.64.45.0/24"
            ]
        }
    }

I'll take a look

Change op-mode raw statistics for accel_ppp.py
dict key 'cpu' to 'cpu_load_percentage' and value to integer
@sever-sever
Copy link
Member Author

Something like cpu_load_percentage: 10 is both descriptive and directly usable.

@dmbaturin Done!

vyos@r14# /usr/libexec/vyos/op_mode/accelppp.py show_statistics --protocol l2tp --raw
{
    "sessions": {
        "starting": "0",
        "active": "0"
    },
    "cpu_load_percentage": 0,
    "config_option": {
        "authentication": {
            "mode": "local"
        },
        "client_ip_pool": {
            "subnet": [
                "100.64.45.0/24"
            ]
        }
   

@dmbaturin dmbaturin merged commit 702441a into vyos:current Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants