Aviz Networks AIMS SONIC Ruby API Library
Overview
The Ruby Client for Azure SONIC REST API provides a native Ruby implementation for programming
Aviz Networks SONIC network devices using AIMS. The Ruby client provides the ability to
build native applications in Ruby that can communicate with SONIC remotely over
a HTTP transport protocol.
The Ruby API implemenation also provides an API layer for building native Ruby
objects that allow for configuration and management of Aviz Networks SONIC switches using AIMS.
Requirements
- Aviz Networks SONIC switches
- Ruby 2.2.3 or later
SONIC Ruby APIs
The SONIC Ruby Client was designed to be easy to use and develop plugins or tools
that interface with the Aviz Networks SONIC switches.
Using the API
See the below example for using the API. Also refer test/ directory for more details.
Switch Configuration file
This configuration file is used to define the configuration options or model for switches (switch.yml or any xxx.yml)
protocol : 'http'
port : '8090'
ip : 'switch ip address'
user : 'username'
password : 'password'
Creating connection and sending configurations
Below demonstrates a basic connection using the API. For more examples please see the examples folder
require 'sonic-rbapi/connect'
require 'sonic-rbapi/vlan'
conn = Connect.new(param)
where param is a dictionary formed either from the config file or hardcoded
with the following key value pairs
protocol => 'http'
port => '8090'
ip => 'switch ip address'
user => 'username'
password => 'password'
Vlan.get_all_vlan(conn)
vlan_id = 10
dhcp_servers = ["10.10.10.1", "10.10.10.2"]
resp = Vlan.create_vlan(conn, vlan_id, dhcp_servers)
resp = Vlan.get_vlan(conn, 20)
Vlan.delete_vlan(conn, 20)