NAME
Net::Versa::Director - Versa Director REST API client library
VERSION
version 0.002000
SYNOPSIS
use v5.36;
use Net::Versa::Director;
my $director = Net::Versa::Director->new(
server => 'https://director.example.com:9182',
user => 'username',
passwd => '$password',
clientattrs => {
timeout => 10,
},
);
DESCRIPTION
This module is a client library for the Versa Director REST API using the basic authentication API endpoint on port 9182.
Currently it is developed and tested against version 21.2.
For more information see https://docs.versa-networks.com/Management_and_Orchestration/Versa_Director/Director_REST_APIs/01_Versa_Director_REST_API_Overview.
METHODS
get_director_info
Returns the Versa Director information as hashref.
From /api/operational/system/package-info.
get_version
Returns the Versa Director version.
From "get_director_info"->{branch}.
list_appliances
Returns an arrayref of Versa appliances.
From /vnms/appliance/appliance.
list_device_workflows
Returns an arrayref of device workflows.
From /vnms/sdwan/workflow/devices.
get_device_workflow
Takes a workflow name.
Returns a hashref of device workflow data.
From /vnms/sdwan/workflow/devices/device/$device_workflow_name.
list_assets
Returns an arrayref of Versa appliances.
From /vnms/assets/asset.
list_device_interfaces
Takes a device name.
Returns an arrayref of interface hashrefs.
From /api/config/devices/device/$devicename/config/interfaces/vni?deep.
list_device_networks
Takes a device name.
Returns an arrayref of network hashrefs.
From /api/config/devices/device/$devicename/config/networks/network?deep=true.
ERROR handling
All methods throw an exception on error returning the unmodified data from the API as hashref.
Currently the Versa Director has to different API error formats depending on the type of request.
authentication errors
The response of an authentication error looks like this:
{
code => 4001,
description => "Invalid user name or password.",
http_status_code => 401,
message => "Unauthenticated",
more_info => "http://nms.versa.com/errors/4001",
}
YANG data model errors
All API endpoints starting with /api/config or /api/operational return this type of error:
YANG and relational data model errors
All API endpoints starting with /vnms return this type of error:
{
error => "Not Found",
exception => "com.versa.vnms.common.exception.VOAEException",
http_status_code => 404,
message => " device work flow non-existing does not exist ",
path => "/vnms/sdwan/workflow/devices/device/non-existing",
timestamp => 1696574964569,
}
TESTS
To run the live API tests the following environment variables need to be set:
- NET_VERSA_DIRECTOR_HOSTNAME
- NET_VERSA_DIRECTOR_USERNAME
- NET_VERSA_DIRECTOR_PASSWORD
Only read calls are tested so far.
AUTHOR
Alexander Hartmaier <abraxxa@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2023 by Alexander Hartmaier.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.