lenovo-rbapi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +25 -0
- data/README.md +76 -0
- data/lib/cnos-rbapi.rb +16 -0
- data/lib/cnos-rbapi/arp.rb +115 -0
- data/lib/cnos-rbapi/connect.rb +146 -0
- data/lib/cnos-rbapi/igmp.rb +117 -0
- data/lib/cnos-rbapi/ip_intf.rb +93 -0
- data/lib/cnos-rbapi/lacp.rb +64 -0
- data/lib/cnos-rbapi/lag.rb +207 -0
- data/lib/cnos-rbapi/lldp.rb +173 -0
- data/lib/cnos-rbapi/mstp.rb +214 -0
- data/lib/cnos-rbapi/rest_utils.rb +111 -0
- data/lib/cnos-rbapi/stp.rb +93 -0
- data/lib/cnos-rbapi/system.rb +523 -0
- data/lib/cnos-rbapi/telemetry.rb +285 -0
- data/lib/cnos-rbapi/valn_intf.rb +0 -0
- data/lib/cnos-rbapi/vlag.rb +275 -0
- data/lib/cnos-rbapi/vlan.rb +124 -0
- data/lib/cnos-rbapi/vlan_intf.rb +89 -0
- data/lib/cnos-rbapi/vrrp.rb +198 -0
- data/test/rbapi_test.rb +1046 -0
- metadata +69 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3fc4f268227846d053298925f33b12c71f52068f5fdc784aff2ead47d8c60974
|
4
|
+
data.tar.gz: 6ea37824a3dfe81aa071ea038a2798df130954d60526430fe6000a02c41ee7b4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ab352ca7fc229add45f71958a3f039ab9c1e3532848a6aa0f8ce30af81f750966fc6402ff079dacf61a08040a714b1d1b1da512a3b852ad1853c8dd5f5f08697
|
7
|
+
data.tar.gz: a6567500337371878f24d35a33a92677afe831bd244dd12b31e714a465cd457e18c9144a8fbd28d44bf03d3cebad4815a816b079fa3d185cc842d63b800d353d
|
data/LICENSE.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
4
|
+
## Redistribution and use in source and binary forms, with or without
|
5
|
+
## modification, are permitted provided that the following conditions are met:
|
6
|
+
## 1. Redistributions of source code must retain the above copyright notice,
|
7
|
+
## this list of conditions and the following disclaimer.
|
8
|
+
## 2. Redistributions in binary form must reproduce the above copyright notice,
|
9
|
+
## this list of conditions and the following disclaimer in the documentation
|
10
|
+
## and/or other materials provided with the distribution.
|
11
|
+
## 3. Neither the name of the copyright holder nor the names of its contributors
|
12
|
+
## may be used to endorse or promote products derived from this software
|
13
|
+
## without specific prior written permission.
|
14
|
+
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
15
|
+
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
17
|
+
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
18
|
+
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
19
|
+
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
20
|
+
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
21
|
+
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
22
|
+
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
23
|
+
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
24
|
+
## POSSIBILITY OF SUCH DAMAGE
|
25
|
+
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Lenovo CNOS Ruby API Library
|
2
|
+
|
3
|
+
#### Table of Contents
|
4
|
+
1. Overview
|
5
|
+
2. Requirements
|
6
|
+
3. CNOS Ruby APIs
|
7
|
+
3.1 Using Ruby APIs
|
8
|
+
4. License
|
9
|
+
|
10
|
+
1. Overview
|
11
|
+
The Ruby Client for CNOS API provides a native Ruby implementation for programming
|
12
|
+
Lenovo CNOS network devices using Ruby. The Ruby client provides the ability to
|
13
|
+
build native applications in Ruby that can communicate with CNOS remotely over
|
14
|
+
a HTTP/S transport (off-box).
|
15
|
+
|
16
|
+
The Ruby API implemenation also provides an API layer for building native Ruby
|
17
|
+
objects that allow for configuration and management of Lenovo CNOS switches.
|
18
|
+
|
19
|
+
The libray is freely provided to the open source community for building applications
|
20
|
+
using CNOS REST API infrastrcuture. Support is provided as best effort through
|
21
|
+
Github iusses.
|
22
|
+
|
23
|
+
2. Requirements
|
24
|
+
* Lenovo CNOS 10.4 or later
|
25
|
+
* Ruby 2.2.3 or later
|
26
|
+
|
27
|
+
3. CNOS Ruby APIs
|
28
|
+
The CNOS Ruby Client was designed to be easy to use and develop plugins or tools
|
29
|
+
that interface with the Lenovo CNOS switches.
|
30
|
+
|
31
|
+
3.1 Using the API
|
32
|
+
|
33
|
+
3.1.1 Switch Configutation file
|
34
|
+
This configuration file is used to define the configuration options or model for
|
35
|
+
switches (switch.yml or any xxx.yml)
|
36
|
+
|
37
|
+
transport : 'http' #transport (HTTP/HTTPs)
|
38
|
+
port : '8090' #HTTP(s) port number (8090 - HTTP, 443 - HTTPs)
|
39
|
+
ip : 'switch ip address' #Switch IP address
|
40
|
+
user : '<username>' #Switch Credentials
|
41
|
+
password : '<password>'
|
42
|
+
|
43
|
+
3.1.2 Creating connection and sending configurations
|
44
|
+
Below demonstrates a basic connection using the API.
|
45
|
+
For more examples, please see the examples folder.
|
46
|
+
|
47
|
+
#import the libraries
|
48
|
+
require 'cnos-rbapi/connect'
|
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' #transport (HTTP/HTTPs)
|
58
|
+
port => '8090' #HTTP(s) port number (8090 - HTTP, 443 - HTTPs)
|
59
|
+
ip => 'switch ip address' #Switch IP address
|
60
|
+
user => '<username>' #Switch Credentials
|
61
|
+
password => '<password>'
|
62
|
+
|
63
|
+
#Use VLAN APIs to retrieve VLAN information
|
64
|
+
Vlan.get_all_vlan(conn)
|
65
|
+
|
66
|
+
#Use VLAN APIs to create/update and delete VLANs
|
67
|
+
params = {"vlan_name" => "test", "vlan_id" => 10, "admin_state" => "up"}
|
68
|
+
resp = Vlan.create_vlan(conn, params)
|
69
|
+
|
70
|
+
resp = Vlan.get_vlan_prop(conn, 10)
|
71
|
+
|
72
|
+
params = {"vlan_name" => "test", "admin_state" => "up"}
|
73
|
+
resp = Vlan.update_vlan(conn, 10, params)
|
74
|
+
|
75
|
+
Vlan.delete_vlan(conn, 10)
|
76
|
+
|
data/lib/cnos-rbapi.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
##
|
2
|
+
### Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
###
|
4
|
+
### This program and the accompanying materials are licensed and made available
|
5
|
+
### under the terms and conditions of the 3-clause BSD License that accompanies
|
6
|
+
### this distribution.
|
7
|
+
###
|
8
|
+
### The full text of the license may be found at
|
9
|
+
###
|
10
|
+
### https://opensource.org/licenses/BSD-3-Clause
|
11
|
+
###
|
12
|
+
### THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
13
|
+
### WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
14
|
+
###
|
15
|
+
#
|
16
|
+
require 'cnos-rbapi/connect.rb'
|
@@ -0,0 +1,115 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
4
|
+
## This program and the accompanying materials are licensed and made available
|
5
|
+
## under the terms and conditions of the 3-clause BSD License that accompanies
|
6
|
+
## this distribution.
|
7
|
+
##
|
8
|
+
## The full text of the license may be found at
|
9
|
+
##
|
10
|
+
## https://opensource.org/licenses/BSD-3-Clause
|
11
|
+
##
|
12
|
+
## THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
13
|
+
## WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
14
|
+
##
|
15
|
+
require 'rest-client'
|
16
|
+
require 'json'
|
17
|
+
require_relative 'connect'
|
18
|
+
require_relative 'rest_utils'
|
19
|
+
|
20
|
+
|
21
|
+
##
|
22
|
+
## The Arp class provides a class implementation and methods for managing the ARP
|
23
|
+
## on the node. This class presents an abstraction
|
24
|
+
##
|
25
|
+
|
26
|
+
class Arp
|
27
|
+
@cfg = '/nos/api/cfg/arp'
|
28
|
+
|
29
|
+
# This API gets the ARP properties of the system.
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# parameters:
|
33
|
+
# conn - connection object to the node
|
34
|
+
#
|
35
|
+
# return: JSON response
|
36
|
+
def self.get_arp_sys_prop(conn)
|
37
|
+
url = form_url(conn, @cfg)
|
38
|
+
hdr = form_hdr(conn)
|
39
|
+
Rest.get(conn, url, hdr)
|
40
|
+
end
|
41
|
+
|
42
|
+
# This API gets the ARP properties of all interfaces.
|
43
|
+
#
|
44
|
+
#
|
45
|
+
# parameters:
|
46
|
+
# conn - connection object to the node
|
47
|
+
#
|
48
|
+
# return: JSON response
|
49
|
+
def self.get_arp_prop_all(conn)
|
50
|
+
url = form_url(conn, @cfg + '_interface')
|
51
|
+
hdr = form_hdr(conn)
|
52
|
+
Rest.get(conn, url, hdr)
|
53
|
+
end
|
54
|
+
|
55
|
+
# This API updates the ARP properties of the system.
|
56
|
+
#
|
57
|
+
#
|
58
|
+
# parameters:
|
59
|
+
# conn - connection object to the node
|
60
|
+
# params - dictionary that requires the following format of key-value pairs
|
61
|
+
# {
|
62
|
+
# “ageout_time” : “<ageout_time>”
|
63
|
+
# }
|
64
|
+
# description -
|
65
|
+
# ageout_time :The global ARP entry age‐out time, in seconds; an integer from 60‐28800. Default value: 1500 seconds.
|
66
|
+
#
|
67
|
+
# return: JSON response
|
68
|
+
def self.set_arp_sys_prop(conn, params)
|
69
|
+
url = form_url(conn, @cfg)
|
70
|
+
hdr = form_hdr(conn)
|
71
|
+
params = params.to_json
|
72
|
+
Rest.put(conn, url, hdr, params)
|
73
|
+
end
|
74
|
+
|
75
|
+
# This API gets the ARP properties of one interface.
|
76
|
+
#
|
77
|
+
#
|
78
|
+
# parameters:
|
79
|
+
# conn - connection object to the node
|
80
|
+
#
|
81
|
+
# return: JSON response
|
82
|
+
def self.get_arp_intf_prop(conn, intf)
|
83
|
+
temp = intf.dup
|
84
|
+
temp.sub! '/', '%2F'
|
85
|
+
url = form_url(conn, @cfg + '_interface/' + temp)
|
86
|
+
hdr = form_hdr(conn)
|
87
|
+
Rest.get(conn, url, hdr)
|
88
|
+
end
|
89
|
+
|
90
|
+
# This API updates the ARP properties of one interface.
|
91
|
+
#
|
92
|
+
#
|
93
|
+
# parameters:
|
94
|
+
# conn - connection object to the node
|
95
|
+
# params - dictionary that requires the following format of key-value pairs
|
96
|
+
# {
|
97
|
+
# "if_name": "<if_name>",
|
98
|
+
# “ageout_time” : “<ageout_time>”
|
99
|
+
# }
|
100
|
+
# description -
|
101
|
+
# if_name :IP interface name (String).Note: The interface must exist.
|
102
|
+
# ageout_time :The global ARP entry age‐out time, in seconds; an integer from 60‐28800. Default value: 1500 seconds.
|
103
|
+
#
|
104
|
+
# return: JSON response
|
105
|
+
def self.set_arp_intf_prop(conn, intf, params)
|
106
|
+
temp = intf.dup
|
107
|
+
temp.sub! '/', '%2F'
|
108
|
+
url = form_url(conn, @cfg + '_interface/' + temp)
|
109
|
+
hdr = form_hdr(conn)
|
110
|
+
params = params.to_json
|
111
|
+
Rest.put(conn, url, hdr, params)
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
@@ -0,0 +1,146 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
4
|
+
## This program and the accompanying materials are licensed and made available
|
5
|
+
## under the terms and conditions of the 3-clause BSD License that accompanies
|
6
|
+
## this distribution.
|
7
|
+
##
|
8
|
+
## The full text of the license may be found at
|
9
|
+
##
|
10
|
+
## https://opensource.org/licenses/BSD-3-Clause
|
11
|
+
##
|
12
|
+
## THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
13
|
+
## WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
14
|
+
##
|
15
|
+
require 'rest-client'
|
16
|
+
require 'yaml'
|
17
|
+
|
18
|
+
def form_hdr(conn)
|
19
|
+
hdr = {}
|
20
|
+
tmp_ckie = 'auth_cookie='+ conn.getCookie + ';user=' + conn.getUser + '; Max-Age=3600; Path=/'
|
21
|
+
hdr['Cookie'] = tmp_ckie
|
22
|
+
hdr['Content-type'] = 'application/json'
|
23
|
+
return hdr
|
24
|
+
end
|
25
|
+
|
26
|
+
def form_url(conn, url)
|
27
|
+
url = conn.getTransport + '://' + conn.getIp + ':' + conn.getPort + url
|
28
|
+
return url
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
## The Connect class provides a class implementation and methods for establishing node connections and
|
33
|
+
## initializations. This class presents an abstraction
|
34
|
+
##
|
35
|
+
|
36
|
+
class Connect
|
37
|
+
|
38
|
+
# This function is used to initialise node paramters and establish connection with the given paramters.
|
39
|
+
#
|
40
|
+
#
|
41
|
+
# parameters:
|
42
|
+
# file :config file
|
43
|
+
#
|
44
|
+
# return: Connect object
|
45
|
+
def initialize(params)
|
46
|
+
@transport = params['transport']
|
47
|
+
@port = params['port']
|
48
|
+
@ip = params['ip']
|
49
|
+
@user = params['user']
|
50
|
+
@password = params['password']
|
51
|
+
@cookie = ''
|
52
|
+
if @transport == 'http'
|
53
|
+
@url = @transport + '://' + @ip + ':' + @port + '/nos/api/login/'
|
54
|
+
end
|
55
|
+
if @transport == 'https'
|
56
|
+
@url = @transport + '://' + @ip + '/nos/api/login/'
|
57
|
+
end
|
58
|
+
|
59
|
+
begin
|
60
|
+
RestClient::Request.execute(method: :get, url: @url, user: @user, password: @password, timeout: 10, :verify_ssl => false)
|
61
|
+
rescue RestClient::Unauthorized, RestClient::Forbidden => err
|
62
|
+
@cookie = err.response.cookies['auth_cookie']
|
63
|
+
end
|
64
|
+
|
65
|
+
@hdr = {}
|
66
|
+
tmp_ckie = 'auth_cookie=' + @cookie + ';user=' + @user + '; Max-Age=3600; Path=/'
|
67
|
+
@hdr['Cookie'] = tmp_ckie
|
68
|
+
resp = RestClient::Request.execute(method: :get, url: @url, headers: @hdr, user: @user, password: @password, timeout: 10, :verify_ssl => false)
|
69
|
+
@cookie = resp.cookies['auth_cookie']
|
70
|
+
@hdr['Content-type'] = 'application/json'
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
# This API returns Transport protocol for the current node connection.
|
76
|
+
#
|
77
|
+
#
|
78
|
+
# parameters:
|
79
|
+
#
|
80
|
+
# return: transport - string
|
81
|
+
def getTransport()
|
82
|
+
return @transport
|
83
|
+
end
|
84
|
+
|
85
|
+
# This API returns Port for the current node connection.
|
86
|
+
#
|
87
|
+
#
|
88
|
+
# parameters:
|
89
|
+
#
|
90
|
+
# return: port - string
|
91
|
+
def getPort()
|
92
|
+
return @port
|
93
|
+
end
|
94
|
+
|
95
|
+
# This API returns IP for the current node connection.
|
96
|
+
#
|
97
|
+
#
|
98
|
+
# parameters:
|
99
|
+
#
|
100
|
+
# return: IP - string
|
101
|
+
def getIp()
|
102
|
+
return @ip
|
103
|
+
end
|
104
|
+
|
105
|
+
# This API returns User for the current node connection.
|
106
|
+
#
|
107
|
+
#
|
108
|
+
# parameters:
|
109
|
+
#
|
110
|
+
# return: User - string
|
111
|
+
def getUser()
|
112
|
+
return @user
|
113
|
+
end
|
114
|
+
|
115
|
+
# This API returns Password for the current node connection.
|
116
|
+
#
|
117
|
+
#
|
118
|
+
# parameters:
|
119
|
+
#
|
120
|
+
# return: Password - string
|
121
|
+
def getPassword()
|
122
|
+
return @password
|
123
|
+
end
|
124
|
+
|
125
|
+
# This API returns Cookie for the current node connection.
|
126
|
+
#
|
127
|
+
#
|
128
|
+
# parameters:
|
129
|
+
#
|
130
|
+
# return: Cookie - string
|
131
|
+
def getCookie()
|
132
|
+
return @cookie
|
133
|
+
end
|
134
|
+
|
135
|
+
# This API returns Header Info for the current node connection.
|
136
|
+
#
|
137
|
+
#
|
138
|
+
# parameters:
|
139
|
+
#
|
140
|
+
# return: header - string
|
141
|
+
def getHdr()
|
142
|
+
return @hdr
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
##
|
2
|
+
## Copyright (c) 2017, Lenovo. All rights reserved.
|
3
|
+
##
|
4
|
+
## This program and the accompanying materials are licensed and made available
|
5
|
+
## under the terms and conditions of the 3-clause BSD License that accompanies
|
6
|
+
## this distribution.
|
7
|
+
##
|
8
|
+
## The full text of the license may be found at
|
9
|
+
##
|
10
|
+
## https://opensource.org/licenses/BSD-3-Clause
|
11
|
+
##
|
12
|
+
## THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
13
|
+
## WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
14
|
+
##
|
15
|
+
require 'rest-client'
|
16
|
+
require 'json'
|
17
|
+
require_relative 'connect'
|
18
|
+
require_relative 'rest_utils'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
##
|
23
|
+
## The Igmp class provides a class implementation and methods for managing the IGMP
|
24
|
+
## on the node. This class presents an abstraction
|
25
|
+
##
|
26
|
+
class Igmp
|
27
|
+
@cfg = '/nos/api/cfg/igmp'
|
28
|
+
|
29
|
+
# This API gets IGMP Snooping properties of the system.
|
30
|
+
#
|
31
|
+
#
|
32
|
+
# parameters:
|
33
|
+
# conn - connection object to the node
|
34
|
+
#
|
35
|
+
# return: JSON response
|
36
|
+
def self.get_igmp_snoop_prop(conn)
|
37
|
+
url = form_url(conn, @cfg + '/snoop')
|
38
|
+
hdr = form_hdr(conn)
|
39
|
+
Rest.get(conn, url, hdr)
|
40
|
+
end
|
41
|
+
|
42
|
+
# This API update the global IGMP Snooping properties of the system.
|
43
|
+
#
|
44
|
+
#
|
45
|
+
# parameters:
|
46
|
+
# conn - connection object to the node
|
47
|
+
# params - dictionary that requires the following format of key-value pairs
|
48
|
+
# {
|
49
|
+
# "ena_igmp_snoop": "<ena_igmp_snoop>"
|
50
|
+
# }
|
51
|
+
# description -
|
52
|
+
# ena_igmp_ snoop :Enables IGMP snooping globally on all VLANs; one of yes
|
53
|
+
# (default), no.
|
54
|
+
# If disabled globally, IGMP snooping is disabled on all VLANs,
|
55
|
+
# regardless of the per‐VLAN setting of IGMP snooping. If IGMP
|
56
|
+
# snooping is enabled globally, the per‐VLAN setting of IGMP
|
57
|
+
# snooping takes effect.
|
58
|
+
#
|
59
|
+
#
|
60
|
+
# return: JSON response
|
61
|
+
def self.set_igmp_snoop_prop(conn, params)
|
62
|
+
url = form_url(conn, @cfg + '/snoop')
|
63
|
+
hdr = form_hdr(conn)
|
64
|
+
params = params.to_json
|
65
|
+
Rest.put(conn, url, hdr, params)
|
66
|
+
end
|
67
|
+
|
68
|
+
# This API gets IGMP Snooping properties of one VLANs.
|
69
|
+
#
|
70
|
+
#
|
71
|
+
# parameters:
|
72
|
+
# conn - connection object to the node
|
73
|
+
# vlan_id - VLAN number
|
74
|
+
#
|
75
|
+
# return: JSON response
|
76
|
+
def self.get_igmp_vlan_prop(conn, vlan_id)
|
77
|
+
temp = @cfg.dup
|
78
|
+
temp.sub! 'igmp', 'mc_vlan/' + vlan_id.to_s
|
79
|
+
url = form_url(conn, temp)
|
80
|
+
hdr = form_hdr(conn)
|
81
|
+
Rest.get(conn, url, hdr)
|
82
|
+
end
|
83
|
+
|
84
|
+
# This API update the global IGMP Snooping properties of the specified VLAN.
|
85
|
+
#
|
86
|
+
#
|
87
|
+
# parameters:
|
88
|
+
# conn - connection object to the node
|
89
|
+
# vlan_id - VLAN number
|
90
|
+
# params - dictionary that requires the following format of key-value pairs
|
91
|
+
# {
|
92
|
+
# "vlan_id": "<vlan_id>",
|
93
|
+
# "ena_igmp_snoop": "<ena_igmp_snoop>",
|
94
|
+
# "fast_leave": "<fast_leave>",
|
95
|
+
# "query_interval": "<query_interval>",
|
96
|
+
# "version": "<version>",
|
97
|
+
# }
|
98
|
+
# description -
|
99
|
+
# vlan_id :VLAN number.Note: The VLAN must exist.
|
100
|
+
# ena_igmp_snoop :(Optional) Whether to enable IGMP snooping on a VLAN; one of
|
101
|
+
# yes, no. Default value: yes.
|
102
|
+
# fast_leave :One of yes, no. Default value: no.
|
103
|
+
# query_interval :(Optional) IGMP query interval, in seconds; an integer from
|
104
|
+
# 1‐18000. Default value: 125.
|
105
|
+
# version :(Optional) IGMP Snooping version number; one of 2, 3. Default
|
106
|
+
# value: 3
|
107
|
+
#
|
108
|
+
# return: JSON response
|
109
|
+
def self.set_igmp_vlan_prop(conn, vlan_id, params)
|
110
|
+
temp = @cfg.dup
|
111
|
+
temp.sub! 'igmp', 'mc_vlan/' + vlan_id.to_s
|
112
|
+
url = form_url(conn, temp)
|
113
|
+
hdr = form_hdr(conn)
|
114
|
+
params = params.to_json
|
115
|
+
Rest.put(conn, url, hdr, params)
|
116
|
+
end
|
117
|
+
end
|