lenovo-rbapi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +84 -76
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 667259711ddfa036e529c429db4ae5fcf06a4574ffea0398e2d1edf0e9dc619c
|
4
|
+
data.tar.gz: 5d11b22f8e97e64612ab04e0df18bbd4e6366e09f986199732c502121aa162cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbfb514565c1d94585d5d333e9f845d24e841774260e33163722d2213d7901ad5114fda216a0cd4e7a23d8d82f35281aa10bdcfd240f083f0dbab7df94dee601
|
7
|
+
data.tar.gz: 7c55b018645c51a1a76f944eab648677c8cd4c8a6ca38bac9a4af9543a7853c2673711548987be4af3eb8e2754ad0d966fc5b393af66dffe63f7a107efb32a15
|
data/README.md
CHANGED
@@ -1,76 +1,84 @@
|
|
1
|
-
# Lenovo CNOS Ruby API Library
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
require 'cnos-rbapi/vlan'
|
50
|
-
|
51
|
-
|
52
|
-
conn = Connect.new(param)
|
53
|
-
|
54
|
-
where param is a dictionary formed either from the config file or hardcoded
|
55
|
-
with the following key value pairs
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
1
|
+
# Lenovo CNOS Ruby API Library
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
The Ruby Client for CNOS API provides a native Ruby implementation for programming
|
5
|
+
Lenovo CNOS network devices using Ruby. The Ruby client provides the ability to
|
6
|
+
build native applications in Ruby that can communicate with CNOS remotely over
|
7
|
+
a HTTP/S transport (off-box).
|
8
|
+
|
9
|
+
The Ruby API implemenation also provides an API layer for building native Ruby
|
10
|
+
objects that allow for configuration and management of Lenovo CNOS switches.
|
11
|
+
|
12
|
+
The library is freely provided to the open source community for building applications
|
13
|
+
using CNOS REST API infrastrcuture. Support is provided as best effort through
|
14
|
+
Github iusses.
|
15
|
+
|
16
|
+
## Requirements
|
17
|
+
* Lenovo CNOS 10.4 or later
|
18
|
+
* Ruby 2.2.3 or later
|
19
|
+
|
20
|
+
## CNOS Ruby APIs
|
21
|
+
The CNOS Ruby Client was designed to be easy to use and develop plugins or tools
|
22
|
+
that interface with the Lenovo CNOS switches.
|
23
|
+
|
24
|
+
### Using the API
|
25
|
+
#### Switch Configutation file
|
26
|
+
This configuration file is used to define the configuration options or model for switches (switch.yml or any xxx.yml)
|
27
|
+
|
28
|
+
##### transport (HTTP/HTTPs)
|
29
|
+
transport : 'http'
|
30
|
+
|
31
|
+
##### HTTP(s) port number (8090 - HTTP, 443 - HTTPs)
|
32
|
+
port : '8090'
|
33
|
+
|
34
|
+
##### Switch IP address
|
35
|
+
ip : 'switch ip address'
|
36
|
+
|
37
|
+
##### Switch Credentials
|
38
|
+
user : 'username'
|
39
|
+
|
40
|
+
password : 'password'
|
41
|
+
|
42
|
+
#### Creating connection and sending configurations
|
43
|
+
Below demonstrates a basic connection using the API. For more examples, please see the examples folder.
|
44
|
+
|
45
|
+
#import the libraries
|
46
|
+
|
47
|
+
require 'cnos-rbapi/connect'
|
48
|
+
|
49
|
+
require 'cnos-rbapi/vlan'
|
50
|
+
|
51
|
+
##### create connection to the node using the configuration file
|
52
|
+
conn = Connect.new(param)
|
53
|
+
|
54
|
+
where param is a dictionary formed either from the config file or hardcoded
|
55
|
+
with the following key value pairs
|
56
|
+
|
57
|
+
##### transport (HTTP/HTTPs)
|
58
|
+
transport => 'http'
|
59
|
+
|
60
|
+
##### HTTP(s) port number (8090 - HTTP, 443 - HTTPs)
|
61
|
+
port => '8090'
|
62
|
+
|
63
|
+
##### Switch IP address
|
64
|
+
ip => 'switch ip address'
|
65
|
+
|
66
|
+
##### Switch Credentials
|
67
|
+
user => 'username'
|
68
|
+
password => 'password'
|
69
|
+
|
70
|
+
##### Use VLAN APIs to retrieve VLAN information
|
71
|
+
Vlan.get_all_vlan(conn)
|
72
|
+
|
73
|
+
params = {"vlan_name" => "test", "vlan_id" => 10, "admin_state" => "up"}
|
74
|
+
|
75
|
+
##### Use VLAN APIs to create/update and delete VLANs
|
76
|
+
resp = Vlan.create_vlan(conn, params)
|
77
|
+
|
78
|
+
resp = Vlan.get_vlan_prop(conn, 10)
|
79
|
+
|
80
|
+
params = {"vlan_name" => "test", "admin_state" => "up"}
|
81
|
+
|
82
|
+
resp = Vlan.update_vlan(conn, 10, params)
|
83
|
+
|
84
|
+
Vlan.delete_vlan(conn, 10)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lenovo-rbapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coleen Quadros
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-01-
|
12
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Lib for CNOS REST API's using Ruby
|
15
15
|
email:
|