ucslib 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +151 -0
- data/README.rdoc +88 -101
- data/lib/ucslib/Gemfile +4 -0
- data/lib/ucslib/{destroy.rb → service/ucs/destroy.rb} +3 -12
- data/lib/ucslib/{inventory.rb → service/ucs/inventory.rb} +34 -31
- data/lib/ucslib/{manage.rb → service/ucs/manage.rb} +14 -22
- data/lib/ucslib/{parser.rb → service/ucs/parser.rb} +19 -19
- data/lib/ucslib/{provision.rb → service/ucs/provision.rb} +59 -66
- data/lib/ucslib/service/ucs/session.rb +110 -0
- data/lib/ucslib/{stats.rb → service/ucs/stats.rb} +21 -1
- data/lib/ucslib/service/ucs/ucs.rb +70 -0
- data/lib/ucslib/{update.rb → service/ucs/update.rb} +9 -17
- data/lib/ucslib/version.rb +2 -1
- data/lib/ucslib.rb +3 -8
- metadata +26 -71
- data/.gitignore +0 -4
- data/Gemfile +0 -4
- data/html/README_rdoc.html +0 -226
- data/html/UCSInventory.html +0 -533
- data/html/UCSProvision.html +0 -1914
- data/html/UCSToken.html +0 -338
- data/html/Ucslib.html +0 -173
- data/html/created.rid +0 -7
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +0 -273
- data/html/js/darkfish.js +0 -116
- data/html/js/jquery.js +0 -32
- data/html/js/quicksearch.js +0 -114
- data/html/js/thickbox-compressed.js +0 -10
- data/html/lib/ucslib/inventory_rb.html +0 -75
- data/html/lib/ucslib/provision_rb.html +0 -75
- data/html/lib/ucslib/session_rb.html +0 -75
- data/html/lib/ucslib/version_rb.html +0 -75
- data/html/lib/ucslib_rb.html +0 -89
- data/html/rdoc.css +0 -763
- data/lib/ucslib/session.rb +0 -108
- data/ucslib.gemspec +0 -45
@@ -0,0 +1,70 @@
|
|
1
|
+
# Author:: Murali Raju (<murali.raju@appliv.com>)
|
2
|
+
# Copyright:: Copyright (c) 2012 Murali Raju.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'ucslib/service/ucs/session'
|
19
|
+
require 'ucslib/service/ucs/provision'
|
20
|
+
require 'ucslib/service/ucs/parser'
|
21
|
+
require 'ucslib/service/ucs/update'
|
22
|
+
require 'ucslib/service/ucs/inventory'
|
23
|
+
require 'ucslib/service/ucs/destroy'
|
24
|
+
require 'ucslib/service/ucs/manage'
|
25
|
+
require 'ucslib/service/ucs/stats'
|
26
|
+
|
27
|
+
|
28
|
+
class UCS
|
29
|
+
include Session
|
30
|
+
include Update
|
31
|
+
include Stats
|
32
|
+
include Provision
|
33
|
+
include Parser
|
34
|
+
include Manage
|
35
|
+
include Inventory
|
36
|
+
include Destroy
|
37
|
+
|
38
|
+
def initialize (authjson)
|
39
|
+
|
40
|
+
username = "#{JSON.parse(authjson)['username']}"
|
41
|
+
password = "#{JSON.parse(authjson)['password']}"
|
42
|
+
ip = "#{JSON.parse(authjson)['ip']}"
|
43
|
+
@url = "https://#{ip}/nuova"
|
44
|
+
|
45
|
+
xml_builder = Nokogiri::XML::Builder.new do |xml|
|
46
|
+
xml.aaaLogin('inName' => username, 'inPassword' => password)
|
47
|
+
end
|
48
|
+
|
49
|
+
aaa_login_xml = xml_builder.to_xml.to_s
|
50
|
+
ucs_response = RestClient.post(@url, aaa_login_xml, :content_type => 'text/xml').body
|
51
|
+
ucs_login_doc = Nokogiri::XML(ucs_response)
|
52
|
+
ucs_login_root = ucs_login_doc.root
|
53
|
+
@cookie = ucs_login_root.attributes['outCookie']
|
54
|
+
|
55
|
+
|
56
|
+
# Archive code to be removed later. #TODO
|
57
|
+
# begin
|
58
|
+
# return session = { :cookie => "#{cookie}",
|
59
|
+
# :username => "#{username}",
|
60
|
+
# :password => "#{password}",
|
61
|
+
# :ip => "#{ip}" }.to_json
|
62
|
+
# rescue Exception => e
|
63
|
+
# 'An Error Occured. Please check authentication credentials'
|
64
|
+
# else
|
65
|
+
# Process.exit
|
66
|
+
# end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -15,18 +15,10 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
def initialize(tokenjson)
|
21
|
-
|
22
|
-
@cookie = "#{JSON.parse(tokenjson)['cookie']}"
|
23
|
-
ip = "#{JSON.parse(tokenjson)['ip']}"
|
24
|
-
@url = "https://#{ip}/nuova"
|
18
|
+
module Update
|
25
19
|
|
26
|
-
end
|
27
|
-
|
28
20
|
def update_host_firmware_package(json)
|
29
|
-
|
21
|
+
|
30
22
|
host_firmware_pkg_name = JSON.parse(json)['host_firmware_pkg_name']
|
31
23
|
hardware_model = JSON.parse(json)['hardware_model'].to_s
|
32
24
|
hardware_type = JSON.parse(json)['hardware_type']
|
@@ -64,21 +56,21 @@ class UCSUpdate
|
|
64
56
|
end
|
65
57
|
|
66
58
|
def update_boot_policy_on_service_profile_template(json)
|
67
|
-
|
59
|
+
|
68
60
|
service_profile_template_name = JSON.parse(json)['service_profile_template_name']
|
69
61
|
org = JSON.parse(json)['org']
|
70
62
|
service_profile_template_mgmt_ip_pool = JSON.parse(json)['service_profile_template_mgmt_ip_pool']
|
71
63
|
service_profile_template_boot_policy = JSON.parse(json)['service_profile_template_boot_policy']
|
72
64
|
service_profile_template_host_fw_policy = JSON.parse(json)['service_profile_template_host_fw_policy']
|
73
65
|
service_profile_template_uuid_pool = JSON.parse(json)['service_profile_template_uuid_pool']
|
74
|
-
|
66
|
+
|
75
67
|
xml_builder = Nokogiri::XML::Builder.new do |xml|
|
76
68
|
xml.configConfMos('cookie' => "#{@cookie}", 'inHierarchical' => 'false'){
|
77
69
|
xml.inConfigs{
|
78
70
|
xml.pair('key' => "org-root/org-#{org}/ls-#{service_profile_template_name}"){
|
79
71
|
xml.lsServer('agentPolicyName' => '', 'biosProfileName' => '', 'bootPolicyName' => "#{service_profile_template_boot_policy}",
|
80
72
|
'descr' => '', 'dn' => "org-root/org-#{org}/ls-#{service_profile_template_name}",
|
81
|
-
'dynamicConPolicyName' => '', 'extIPPoolName' => "#{service_profile_template_mgmt_ip_pool}",
|
73
|
+
'dynamicConPolicyName' => '', 'extIPPoolName' => "#{service_profile_template_mgmt_ip_pool}",
|
82
74
|
'extIPState' => 'none', 'hostFwPolicyName' => "#{service_profile_template_host_fw_policy}",
|
83
75
|
'identPoolName' => "#{service_profile_template_uuid_pool}", 'localDiskPolicyName' => 'default', 'maintPolicyName' => 'default',
|
84
76
|
'mgmtAccessPolicyName' => '', 'mgmtFwPolicyName' => '', 'policyOwner' => 'local',
|
@@ -90,14 +82,14 @@ class UCSUpdate
|
|
90
82
|
end
|
91
83
|
#Create Template xml
|
92
84
|
update_boot_policy_on_service_profile_template_xml = xml_builder.to_xml.to_s
|
93
|
-
|
85
|
+
|
94
86
|
#Post Update Boot Policy on Service Profile Template
|
95
87
|
begin
|
96
88
|
RestClient.post(@url, update_boot_policy_on_service_profile_template_xml, :content_type => 'text/xml').body
|
97
89
|
rescue Exception => e
|
98
90
|
raise "Error #{e}"
|
99
|
-
end
|
100
|
-
|
91
|
+
end
|
92
|
+
|
101
93
|
end
|
102
|
-
|
94
|
+
|
103
95
|
end
|
data/lib/ucslib/version.rb
CHANGED
data/lib/ucslib.rb
CHANGED
@@ -15,15 +15,10 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
+
|
19
|
+
|
18
20
|
require "ucslib/version"
|
19
|
-
require "ucslib/
|
20
|
-
require "ucslib/provision"
|
21
|
-
require "ucslib/parser"
|
22
|
-
require "ucslib/update"
|
23
|
-
require "ucslib/inventory"
|
24
|
-
require 'ucslib/destroy'
|
25
|
-
require 'ucslib/manage'
|
26
|
-
require 'ucslib/stats'
|
21
|
+
require "ucslib/service/ucs/ucs"
|
27
22
|
|
28
23
|
require 'nokogiri'
|
29
24
|
require 'rest-client'
|
metadata
CHANGED
@@ -1,147 +1,102 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucslib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Murali Raju
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rest-client
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: json
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
|
-
description: Ruby Client Library for Cisco UCS Manager that can be used
|
63
|
-
|
55
|
+
description: Ruby Client Library for Cisco UCS Manager that can be used for Infrastructure
|
56
|
+
Automation
|
64
57
|
email:
|
65
58
|
- murali.raju@appliv.com
|
66
59
|
executables: []
|
67
60
|
extensions: []
|
68
61
|
extra_rdoc_files: []
|
69
62
|
files:
|
70
|
-
- .gitignore
|
71
|
-
- Gemfile
|
72
63
|
- LICENSE.txt
|
64
|
+
- README.md
|
73
65
|
- README.rdoc
|
74
66
|
- Rakefile
|
75
|
-
- html/README_rdoc.html
|
76
|
-
- html/UCSInventory.html
|
77
|
-
- html/UCSProvision.html
|
78
|
-
- html/UCSToken.html
|
79
|
-
- html/Ucslib.html
|
80
|
-
- html/created.rid
|
81
|
-
- html/images/brick.png
|
82
|
-
- html/images/brick_link.png
|
83
|
-
- html/images/bug.png
|
84
|
-
- html/images/bullet_black.png
|
85
|
-
- html/images/bullet_toggle_minus.png
|
86
|
-
- html/images/bullet_toggle_plus.png
|
87
|
-
- html/images/date.png
|
88
|
-
- html/images/find.png
|
89
|
-
- html/images/loadingAnimation.gif
|
90
|
-
- html/images/macFFBgHack.png
|
91
|
-
- html/images/package.png
|
92
|
-
- html/images/page_green.png
|
93
|
-
- html/images/page_white_text.png
|
94
|
-
- html/images/page_white_width.png
|
95
|
-
- html/images/plugin.png
|
96
|
-
- html/images/ruby.png
|
97
|
-
- html/images/tag_green.png
|
98
|
-
- html/images/wrench.png
|
99
|
-
- html/images/wrench_orange.png
|
100
|
-
- html/images/zoom.png
|
101
|
-
- html/index.html
|
102
|
-
- html/js/darkfish.js
|
103
|
-
- html/js/jquery.js
|
104
|
-
- html/js/quicksearch.js
|
105
|
-
- html/js/thickbox-compressed.js
|
106
|
-
- html/lib/ucslib/inventory_rb.html
|
107
|
-
- html/lib/ucslib/provision_rb.html
|
108
|
-
- html/lib/ucslib/session_rb.html
|
109
|
-
- html/lib/ucslib/version_rb.html
|
110
|
-
- html/lib/ucslib_rb.html
|
111
|
-
- html/rdoc.css
|
112
67
|
- lib/ucslib.rb
|
113
|
-
- lib/ucslib/
|
114
|
-
- lib/ucslib/
|
115
|
-
- lib/ucslib/
|
116
|
-
- lib/ucslib/
|
117
|
-
- lib/ucslib/
|
118
|
-
- lib/ucslib/
|
119
|
-
- lib/ucslib/
|
120
|
-
- lib/ucslib/
|
68
|
+
- lib/ucslib/Gemfile
|
69
|
+
- lib/ucslib/service/ucs/destroy.rb
|
70
|
+
- lib/ucslib/service/ucs/inventory.rb
|
71
|
+
- lib/ucslib/service/ucs/manage.rb
|
72
|
+
- lib/ucslib/service/ucs/parser.rb
|
73
|
+
- lib/ucslib/service/ucs/provision.rb
|
74
|
+
- lib/ucslib/service/ucs/session.rb
|
75
|
+
- lib/ucslib/service/ucs/stats.rb
|
76
|
+
- lib/ucslib/service/ucs/ucs.rb
|
77
|
+
- lib/ucslib/service/ucs/update.rb
|
121
78
|
- lib/ucslib/version.rb
|
122
|
-
- ucslib.gemspec
|
123
79
|
homepage: ''
|
124
80
|
licenses: []
|
81
|
+
metadata: {}
|
125
82
|
post_install_message:
|
126
83
|
rdoc_options: []
|
127
84
|
require_paths:
|
128
85
|
- lib
|
129
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
87
|
requirements:
|
132
|
-
- -
|
88
|
+
- - ">="
|
133
89
|
- !ruby/object:Gem::Version
|
134
90
|
version: '0'
|
135
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
-
none: false
|
137
92
|
requirements:
|
138
|
-
- -
|
93
|
+
- - ">="
|
139
94
|
- !ruby/object:Gem::Version
|
140
95
|
version: '0'
|
141
96
|
requirements: []
|
142
97
|
rubyforge_project: ucslib
|
143
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.2.2
|
144
99
|
signing_key:
|
145
|
-
specification_version:
|
100
|
+
specification_version: 4
|
146
101
|
summary: Ruby UCS Manager Client Library
|
147
102
|
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/html/README_rdoc.html
DELETED
@@ -1,226 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
|
5
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
-
<head>
|
7
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
8
|
-
|
9
|
-
<title>File: README.rdoc [ucslib]</title>
|
10
|
-
|
11
|
-
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
|
12
|
-
|
13
|
-
<script src="./js/jquery.js" type="text/javascript"
|
14
|
-
charset="utf-8"></script>
|
15
|
-
<script src="./js/thickbox-compressed.js" type="text/javascript"
|
16
|
-
charset="utf-8"></script>
|
17
|
-
<script src="./js/quicksearch.js" type="text/javascript"
|
18
|
-
charset="utf-8"></script>
|
19
|
-
<script src="./js/darkfish.js" type="text/javascript"
|
20
|
-
charset="utf-8"></script>
|
21
|
-
</head>
|
22
|
-
|
23
|
-
<body class="file">
|
24
|
-
<div id="metadata">
|
25
|
-
<div id="home-metadata">
|
26
|
-
<div id="home-section" class="section">
|
27
|
-
<h3 class="section-header">
|
28
|
-
<a href="./index.html">Home</a>
|
29
|
-
<a href="./index.html#classes">Classes</a>
|
30
|
-
<a href="./index.html#methods">Methods</a>
|
31
|
-
</h3>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="project-metadata">
|
36
|
-
|
37
|
-
|
38
|
-
<div id="fileindex-section" class="section project-section">
|
39
|
-
<h3 class="section-header">Files</h3>
|
40
|
-
<ul>
|
41
|
-
|
42
|
-
<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
|
43
|
-
|
44
|
-
</ul>
|
45
|
-
</div>
|
46
|
-
|
47
|
-
|
48
|
-
<div id="classindex-section" class="section project-section">
|
49
|
-
<h3 class="section-header">Class Index
|
50
|
-
<span class="search-toggle"><img src="./images/find.png"
|
51
|
-
height="16" width="16" alt="[+]"
|
52
|
-
title="show/hide quicksearch" /></span></h3>
|
53
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
54
|
-
<fieldset>
|
55
|
-
<legend>Quicksearch</legend>
|
56
|
-
<input type="text" name="quicksearch" value=""
|
57
|
-
class="quicksearch-field" />
|
58
|
-
</fieldset>
|
59
|
-
</form>
|
60
|
-
|
61
|
-
<ul class="link-list">
|
62
|
-
|
63
|
-
<li><a href="./UCSInventory.html">UCSInventory</a></li>
|
64
|
-
|
65
|
-
<li><a href="./UCSProvision.html">UCSProvision</a></li>
|
66
|
-
|
67
|
-
<li><a href="./UCSToken.html">UCSToken</a></li>
|
68
|
-
|
69
|
-
<li><a href="./Ucslib.html">Ucslib</a></li>
|
70
|
-
|
71
|
-
</ul>
|
72
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
73
|
-
</div>
|
74
|
-
|
75
|
-
|
76
|
-
</div>
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="documentation">
|
80
|
-
|
81
|
-
<h1>ucslib (alpha)</h1>
|
82
|
-
|
83
|
-
<p>Ruby Client Library for Cisco UCS Manager that could be used by DevOps
|
84
|
-
toolchains - Puppet or Chef and other custom tools - to provide MaaS
|
85
|
-
(Metal-as-a-Service) for installing and running OpenStack, Hadoop, etc.
|
86
|
-
ucslib accepts JSON as configuration for provisioning.</p>
|
87
|
-
|
88
|
-
<h2>Install</h2>
|
89
|
-
|
90
|
-
<p>gem install ucslib</p>
|
91
|
-
|
92
|
-
<h2>Usage (example irb session)</h2>
|
93
|
-
|
94
|
-
<p>Just do “require ucslib” in your apps. Below is an introspection of some of
|
95
|
-
the capabilities using IRB.</p>
|
96
|
-
|
97
|
-
<p>➜ ucslib git:(master) ✗ irb 1.9.3p194 :001 > require ‘ucslib’</p>
|
98
|
-
|
99
|
-
<pre>=> true</pre>
|
100
|
-
|
101
|
-
<p>1.9.3p194 :002 > auth_json = { :username => ‘admin’, :password =>
|
102
|
-
‘admin’, :ip => ‘172.16.75.137’ }.to_json</p>
|
103
|
-
|
104
|
-
<pre>=> "{\"username\":\"admin\",\"password\":\"admin\",\"ip\":\"172.16.75.137\"}"</pre>
|
105
|
-
|
106
|
-
<p>1.9.3p194 :003 > ucs_session = UCSToken.new</p>
|
107
|
-
|
108
|
-
<pre>=> #<UCSToken:0x007ff4d92062c0></pre>
|
109
|
-
|
110
|
-
<p>1.9.3p194 :004 > token_json = ucs_session.get_token(auth_json)</p>
|
111
|
-
|
112
|
-
<pre>=> "{\"cookie\":\"1336941096/ea496248-d200-4a10-8e46-c73b59971864\",\"username\":\"admin\",\"password\":\"admin\",\"ip\":\"172.16.75.137\"}"</pre>
|
113
|
-
|
114
|
-
<p>1.9.3p194 :005 > ucs_inventory = UCSInventory.new</p>
|
115
|
-
|
116
|
-
<pre>=> #<UCSInventory:0x007ff4d92cd8c0></pre>
|
117
|
-
|
118
|
-
<p>1.9.3p194 :006 > ucs_provision = <a
|
119
|
-
href="UCSProvision.html#method-c-new">UCSProvision.new(token_json)</a></p>
|
120
|
-
|
121
|
-
<pre>=> #<UCSProvision:0x007ff4d92c0378 @cookie="1336941096/ea496248-d200-4a10-8e46-c73b59971864", @url="https://172.16.75.137/nuova"></pre>
|
122
|
-
|
123
|
-
<p>1.9.3p194 :007 > xml_dump = ucs_inventory.discover(token_json)</p>
|
124
|
-
|
125
|
-
<p>1.9.3p194 :008 > ucs_inventory.methods</p>
|
126
|
-
|
127
|
-
<pre>=> [:discover, :list_blades, :list_vsans, :list_vlans, :list_cpus, :list_memory, :list_service_profiles, :list_running_firmware, :to_json, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__]</pre>
|
128
|
-
|
129
|
-
<p>1.9.3p194 :009 ></p>
|
130
|
-
|
131
|
-
<p>1.9.3p194 :009 > ucs_inventory.list_blades(xml_dump) Blade : 1/5 model:
|
132
|
-
UCSB-B200-M3 with serial: 1049 is powered: off Blade : 1/6 model:
|
133
|
-
N20-B6625-1 with serial: 1053 is powered: off Blade : 1/1 model:
|
134
|
-
N20-B6620-1 with serial: 1045 is powered: on Blade : 1/7 model: N20-B6740-2
|
135
|
-
with serial: 1052 is powered: off Blade : 1/2 model: N20-B6620-1 with
|
136
|
-
serial: 1054 is powered: off Blade : 1/4 model: N20-B6620-1 with serial:
|
137
|
-
1051 is powered: off Blade : 1/3 model: N20-B6620-1 with serial: 1055 is
|
138
|
-
powered: off</p>
|
139
|
-
|
140
|
-
<pre>=> 0</pre>
|
141
|
-
|
142
|
-
<p>1.9.3p194 :010 ></p>
|
143
|
-
|
144
|
-
<p>1.9.3p194 :010 > vlan_json = { :vlan_id => ‘200’, :vlan_name =>
|
145
|
-
‘OpenStack-Mgmt’ }.to_json</p>
|
146
|
-
|
147
|
-
<pre>=> "{\"vlan_id\":\"200\",\"vlan_name\":\"OpenStack-Mgmt\"}"</pre>
|
148
|
-
|
149
|
-
<p>1.9.3p194 :011 > ucs_provision.methods</p>
|
150
|
-
|
151
|
-
<pre>=> [:set_power_policy, :set_chassis_discovery_policy, :set_time_zone, :set_ntp, :create_server_port, :create_network_uplink_port, :create_fc_uplink_port, :create_port_channel, :create_org, :set_local_disk_policy, :create_local_boot_policy, :create_pxe_boot_policy, :create_san_boot_policy, :create_management_ip_pool, :create_vlan, :create_mac_pool, :create_vnic_template, :create_vsan, :create_wwnn_pool, :create_wwpn_pool, :create_vhba_template, :create_uuid_pool, :create_service_profile_template, :create_service_profiles_from_template, :create_service_profiles, :to_json, :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :object_id, :to_enum, :enum_for, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__]</pre>
|
152
|
-
|
153
|
-
<p>1.9.3p194 :012 ></p>
|
154
|
-
|
155
|
-
<p>1.9.3p194 :012 > ucs_provision.create_vlan(vlan_json)</p>
|
156
|
-
|
157
|
-
<pre>=> " <configConfMos cookie=\"1336941096/ea496248-d200-4a10-8e46-c73b59971864\" response=\"yes\"> <outConfigs> <pair key=\"fabric/lan/net-OpenStack-Mgmt\"> <fabricVlan childAction=\"deleteNonPresent\" defaultNet=\"no\" dn=\"fabric/lan/net-OpenStack-Mgmt\" epDn=\"\" id=\"200\" ifRole=\"network\" ifType=\"virtual\" locale=\"external\" name=\"OpenStack-Mgmt\" operState=\"ok\" peerDn=\"\" pubNwDn=\"\" pubNwId=\"0\" pubNwName=\"\" sharing=\"none\" status=\"created\" switchId=\"dual\" transport=\"ether\" type=\"lan\"/> </pair> </outConfigs> </configConfMos>"</pre>
|
158
|
-
|
159
|
-
<p>1.9.3p194 :013 ></p>
|
160
|
-
|
161
|
-
<p>1.9.3p194 :015 > xml_dump = ucs_inventory.discover(token_json)</p>
|
162
|
-
|
163
|
-
<p>1.9.3p194 :015 > ucs_inventory.list_vlans(xml_dump) VLAN: 1 with name:
|
164
|
-
default VLAN: 1 with name: default VLAN: 5 with name: human-resource VLAN:
|
165
|
-
1 with name: default VLAN: 3 with name: finance VLAN: 5 with name:
|
166
|
-
human-resource VLAN: 1 with name: default VLAN: 3 with name: finance VLAN:
|
167
|
-
100 with name: Tenant-1 VLAN: 200 with name: OpenStack-Mgmt</p>
|
168
|
-
|
169
|
-
<pre>=> 0</pre>
|
170
|
-
|
171
|
-
<p>1.9.3p194 :016 ></p>
|
172
|
-
|
173
|
-
<h2>Features</h2>
|
174
|
-
<ol><li>
|
175
|
-
<p>List inventory of UCS components</p>
|
176
|
-
</li><li>
|
177
|
-
<p>Provision - turn up ports, create port channels, pools, service profiles</p>
|
178
|
-
</li></ol>
|
179
|
-
|
180
|
-
<h2>ToDo</h2>
|
181
|
-
|
182
|
-
<p>Besides Documentation, Documentation, Documentation!</p>
|
183
|
-
<ol><li>
|
184
|
-
<p>Firmware Management</p>
|
185
|
-
</li><li>
|
186
|
-
<p>Example implementation (workflow) under examples (in progress)</p>
|
187
|
-
</li><li>
|
188
|
-
<p>Server Pools (in progress)</p>
|
189
|
-
</li><li>
|
190
|
-
<p>Service Profile Association (in progress)</p>
|
191
|
-
</li></ol>
|
192
|
-
|
193
|
-
<h2>Contributing to ucslib</h2>
|
194
|
-
<ul><li>
|
195
|
-
<p>Check out the latest master to make sure the feature hasn’t been
|
196
|
-
implemented or the bug hasn’t been fixed yet.</p>
|
197
|
-
</li><li>
|
198
|
-
<p>Check out the issue tracker to make sure someone already hasn’t requested
|
199
|
-
it and/or contributed it.</p>
|
200
|
-
</li><li>
|
201
|
-
<p>Start a feature/bugfix branch.</p>
|
202
|
-
</li><li>
|
203
|
-
<p>Commit and push until you are happy with your contribution.</p>
|
204
|
-
</li><li>
|
205
|
-
<p>Make sure to add tests for it. This is important so I don’t break it in a
|
206
|
-
future version unintentionally.</p>
|
207
|
-
</li><li>
|
208
|
-
<p>Please try not to mess with the Rakefile, version, or history. If you want
|
209
|
-
to have your own version, or is otherwise necessary, that is fine, but
|
210
|
-
please isolate to its own commit so I can cherry-pick around it.</p>
|
211
|
-
</li></ul>
|
212
|
-
|
213
|
-
<h2>Copyright</h2>
|
214
|
-
|
215
|
-
<p>Copyright © 2012 Murali Raju. See LICENSE.txt for further details.</p>
|
216
|
-
|
217
|
-
</div>
|
218
|
-
|
219
|
-
<div id="validator-badges">
|
220
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
221
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
222
|
-
Rdoc Generator</a> 2</small>.</p>
|
223
|
-
</div>
|
224
|
-
</body>
|
225
|
-
</html>
|
226
|
-
|