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

VRP: implement NAC data polling #9592

Merged
merged 14 commits into from Jan 19, 2019
Merged

Conversation

PipoCanaja
Copy link
Contributor

@PipoCanaja PipoCanaja commented Dec 24, 2018

Hello

Here is an implementation for Huawei VRP devices pushing into the existing fields, and also adding time_elapsed and the vlan ID.

  • extend the db via Laravel migrations to:
    • add column time_elapsed (cause huawei does only provide this one, not time_left)
    • add column vlan
    • allow null for time_left
  • Extend the GUI with proper default fields
  • Gather all data from VRP OS
  • Get vlan from Cisco OS

We should keep this in WIP for the moment.

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926
After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

@PipoCanaja
Copy link
Contributor Author

Hi
I will add the test data (probably next week so I can test a little bit before) but it seems that the result is not bad.
vlan and time_elapsed column were added, and by default, a huawei device will have these visible. On all others, I kept the exact same columns visible (but the vlan column could probably be default visible. )
Here is default display for huawei switch.
capture d ecran 2019-01-08 a 15 38 02

@murrant
Copy link
Member

murrant commented Jan 8, 2019

@PipoCanaja you have some upstream commits showing up here. You will need to rebase to remove them.

@PipoCanaja
Copy link
Contributor Author

@PipoCanaja you have some upstream commits showing up here. You will need to rebase to remove them.

Yes, git is just magic to me, sometimes ...

@PipoCanaja
Copy link
Contributor Author

Current status. Starts to appear usable. I'll start testing.

capture d ecran 2019-01-09 a 00 21 32

"time_interval": function (column, row) {
var value = row[column.id];
if (value > 59) {
var date = new Date(null);
Copy link
Member

Choose a reason for hiding this comment

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

you could probably use moment.js here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Will check that.

@murrant murrant added Device 🖥️ New or added device support Schema labels Jan 10, 2019
@murrant
Copy link
Member

murrant commented Jan 15, 2019

The migration needs to be converted for this PR https://laravel.com/docs/5.4/migrations

@PipoCanaja
Copy link
Contributor Author

@murrant Here is the result with moment.duration(xxxxx).humanized(). The value is clearly less precise, what do you think ?

capture d ecran 2019-01-16 a 23 07 53

@murrant
Copy link
Member

murrant commented Jan 17, 2019

@PipoCanaja I figured you would do something like this:

function formatDuration(seconds) {
    var duration = moment.duration(seconds, 's');
    var years = duration.years(),
        months = duration.months(),
        days = duration.days(),
        hrs = duration.hours(),
        mins = duration.minutes(),
        secs = duration.seconds();

    var output = '';
    if (years) {
        output += years + 'y ';
    }
    if (months) {
        output += months + 'm ';
    } else {
        if (days) {
            output += days + 'd ';
        } else {
            output += hrs + ':' + mins + ':' + secs;
        }
    }

    return output.trim();
}

Copy link
Member

@murrant murrant left a comment

Choose a reason for hiding this comment

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

@PipoCanaja merging this, looks good. Feel free to send another PR if you aren't happy with the JS time.

@murrant murrant changed the title VRP: implement NAC data polling (WIP) VRP: implement NAC data polling Jan 19, 2019
@murrant murrant merged commit b474144 into librenms:master Jan 19, 2019
@PipoCanaja PipoCanaja deleted the dot1x-huawei branch March 7, 2019 21:52
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Device 🖥️ New or added device support Schema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants