-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss.4
More file actions
1093 lines (875 loc) · 49.9 KB
/
Copy pathrss.4
File metadata and controls
1093 lines (875 loc) · 49.9 KB
1
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Servers | Containers | Management]]></title><description><![CDATA[Servers | Containers | Management]]></description><link>http://localhost:2368/</link><generator>Ghost 0.11</generator><lastBuildDate>Mon, 07 Nov 2016 23:31:36 GMT</lastBuildDate><atom:link href="http://localhost:2368/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Python and Ctags]]></title><description><![CDATA[<p>You want to jump to definition of a method, but ctags keep taking you to the import line of that method?</p>
<p>add the following to ~/.ctags</p>
<pre><code>--python-kinds=-i
</code></pre>]]></description><link>http://localhost:2368/python-and-ctags/</link><guid isPermaLink="false">cf40fe70-bc98-4dd9-8c69-1ab17f7456ff</guid><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 23:30:58 GMT</pubDate><content:encoded><![CDATA[<p>You want to jump to definition of a method, but ctags keep taking you to the import line of that method?</p>
<p>add the following to ~/.ctags</p>
<pre><code>--python-kinds=-i
</code></pre>]]></content:encoded></item><item><title><![CDATA[Auto-generate python script for tasks done on UI]]></title><description><![CDATA[<p>Welcome the <code>convert_to_ucs_python</code> API.</p>
<p>Assumption:</p>
<p>User knows to do an operation via the JAVA based UCSM GUI <br>
UCSM UI and <code>convert_to_ucs_python</code> should be launched on the same client machine.</p>
<p>Basic Idea:</p>
<ul>
<li>launch the JAVA based UCSM UI</li>
<li>launch the python shell and invoke <code>convert_</code></li></ul>]]></description><link>http://localhost:2368/auto-generate-python-script-for-tasks-done-on-ui/</link><guid isPermaLink="false">fcf18feb-e505-4323-89bf-d51cd6ccb5f6</guid><category><![CDATA[ucsmsdk]]></category><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 23:22:28 GMT</pubDate><content:encoded><![CDATA[<p>Welcome the <code>convert_to_ucs_python</code> API.</p>
<p>Assumption:</p>
<p>User knows to do an operation via the JAVA based UCSM GUI <br>
UCSM UI and <code>convert_to_ucs_python</code> should be launched on the same client machine.</p>
<p>Basic Idea:</p>
<ul>
<li>launch the JAVA based UCSM UI</li>
<li>launch the python shell and invoke <code>convert_to_ucs_python</code></li>
<li>perform the desired operation on the UI</li>
<li><code>convert_to_ucs_python</code> monitors the operation and generates equivalent python script for the same.</li>
</ul>
<p>How it works:</p>
<p>UCSM GUI logs all the activities that are performed via it, and the python shell monitors that log to generate the equivalent python script. Since the logging is local to the machine where the UI is running, <code>convert_to_ucs_python</code> also must run on the same machine. <br>
Sample Usage:</p>
<p>Step 1 - Launch the UCSM GUI.</p>
<pre><code>from ucsmsdk.utils.ucsguilaunch import ucs_gui_launch
from ucsmsdk.ucshandle import UcsHandle
# Login to the server
handle = UcsHandle(<ip>, <username>, <password>)
handle.login()
# launch the UCSM GUI
ucs_gui_launch(handle)
</code></pre>
<p>Step 2 - Run <code>convert_to_ucs_python</code></p>
<p>The CLI will go into a listen mode until Ctrl+C is pressed again. Until then it prints equivalent script for operations done on the UI.</p>
<p>Print the equivalent script to console</p>
<pre><code>from ucsmsdk.utils.converttopython import convert_to_ucs_python
convert_to_ucs_python()
</code></pre>
<p><br>
Print the equivalent script to console, also print the XMLs that the UI sends out</p>
<pre><code>from ucsmsdk.utils.converttopython import convert_to_ucs_python
convert_to_ucs_python(dump_xml=True)
</code></pre>
<p>Output the script to a file</p>
<pre><code>from ucsmsdk.utils.converttopython import convert_to_ucs_python
file_path = r”/home/user/pythoncode.py”
convert_to_ucs_python(dump_to_file=True, dump_file_path=file_path)
</code></pre>
<p>XML to python</p>
<pre><code>xml_str=’‘’<configConfRename
dn=”org-root/ls-ra1”
inNewName=”ra2”
inHierarchical=”false”>
</configConfRename>’‘’
convert_to_ucs_python(xml=True, request=xml_str)
</code></pre>
<p>note:</p>
<p>The path of UCSM UI logs is differs based on the OS and so sometimes the <code>convert_to_ucs_python</code> API may not be able to autodetect the logfiles that it needs to function. The following workaround can be applied in those cases,</p>
<p>Manually find the path to which UCSM UI logs</p>
<pre><code>$ sudo find / -name '.ucsm'
./Library/Application Support/Oracle/Java/Deployment/log/.ucsm
$
</code></pre>
<p>Run <code>convert_to_ucs_python</code> by specifying the log_path</p>
<pre><code>from ucsmsdk.utils.converttopython import convert_to_ucs_python
convert_to_ucs_python(gui_log=True, path=<path that was found above>)
</code></pre>]]></content:encoded></item><item><title><![CDATA[watch for ucs server events - ucsmsdk]]></title><description><![CDATA[<p>Starting 0.9.1.1 we have simplified the code required to wait for an event.</p>
<p>The below code creates a Service Profile Mo <code>org-root/ls-eventhandle</code> <br>
We then create two threads each thread invokes a wait<em>for</em>event method to wait for a specific condition <br>
Here, we wait for the</p>]]></description><link>http://localhost:2368/watch-for-ucs-server-events-ucsmsdk/</link><guid isPermaLink="false">93f6ab52-9442-41cb-a93f-b9073134c1b0</guid><category><![CDATA[ucsmsdk]]></category><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 23:08:02 GMT</pubDate><content:encoded><![CDATA[<p>Starting 0.9.1.1 we have simplified the code required to wait for an event.</p>
<p>The below code creates a Service Profile Mo <code>org-root/ls-eventhandle</code> <br>
We then create two threads each thread invokes a wait<em>for</em>event method to wait for a specific condition <br>
Here, we wait for the <code>descr</code> property to change to specific values</p>
<pre><code>import threading
from ucsmsdk.ucshandle import UcsHandle
from ucsmsdk.mometa.ls.LsServer import LsServer
handle = UcsHandle(<ucsm_ip>, <username>, <password>)
handle.login()
# remove is already exists
sp = handle.query_dn("org-root/ls-eventhandle")
if sp:
handle.remove_mo(sp)
handle.commit()
# add
org = handle.query_dn("org-root")
sp = LsServer(org, name="eventhandle", descr="")
handle.add_mo(sp, True)
handle.commit()
def cb(mce):
print mce.mo.descr
def one():
handle.wait_for_event(sp, "descr", "demo_one", cb)
def two():
handle.wait_for_event(sp, "descr", ["demo_two", "demo_three"], cb)
t1 = threading.Thread(name="thread1", target=one)
t2 = threading.Thread(name="thread2", target=two)
t1.start()
t2.start()
t1.join()
t2.join()
handle.logout()
</code></pre>
<p>The above code when executed will wait, until both the threads finish waiting.</p>
<p>The below script changes the <code>descr</code> property to match condition in thread1. Similarly, thread2's wait ends when either of the two values specified in thread2's <code>wait_for_event</code> are seen.</p>
<pre><code>from ucsmsdk.ucshandle import UcsHandle
handle = UcsHandle(<ucsm_ip>, <username>, <password>)
handle.login()
sp = handle.query_dn("org-root/ls-eventhandle")
# modify
sp.descr = "demo_one"
handle.set_mo(sp)
handle.commit()
handle.logout()
</code></pre>]]></content:encoded></item><item><title><![CDATA[metadata and MO information - ucsmsdk]]></title><description><![CDATA[<p>ucsmsdk now has helper methods to help figure out MO names and dig into the properties and other metadata provided by an object.</p>
<pre><code>from ucsmsdk.ucscoreutils import search_class_id
from ucsmsdk.ucscoreutils import get_meta_info
</code></pre>
<p><code>search_class_id</code> is a case-insensitive grep method that searches all MO names.</p>]]></description><link>http://localhost:2368/metadata-and-mo-information-ucsmsdk/</link><guid isPermaLink="false">fa58f6f5-1977-4ba9-9326-71ef4d005348</guid><category><![CDATA[ucsmsdk]]></category><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 23:06:21 GMT</pubDate><content:encoded><![CDATA[<p>ucsmsdk now has helper methods to help figure out MO names and dig into the properties and other metadata provided by an object.</p>
<pre><code>from ucsmsdk.ucscoreutils import search_class_id
from ucsmsdk.ucscoreutils import get_meta_info
</code></pre>
<p><code>search_class_id</code> is a case-insensitive grep method that searches all MO names.</p>
<pre><code>In [6]: search_class_id("vlan")
2016-06-11 02:26:01,741 - ucs - INFO - "vlan" did not match any available Class Ids.
Related Class Ids are:
----------------------
AdaptorVlan
FabricBHVlan
FabricEthVlanPc
FabricEthVlanPortEp
FabricOrgVlanPolicy
FabricPoolableVlan
FabricPooledVlan
FabricVlan
FabricVlanEp
FabricVlanGroupReq
FabricVlanPermit
FabricVlanReq
SwVlan
SwVlanGroup
SwVlanPortNs
SwVlanPortNsOverride
SwVlanRef
VmVlan
VnicLifVlan
VnicVlan
</code></pre>
<p>Once you have figured the correct MO name, you can use get<em>meta</em>info to dig further into the MO. <br>
Below we get meta information for <code>FabricVlan</code></p>
<p>It starts with a tree view of where <code>FabricVlan</code> fits, it parents and children. <br>
Then it shows MO information <br>
Finally, it shows information about properties of the MO. <br>
Mo Property information: <br>
<code>xml_attribute</code> - the name of the property as expected by the server.</p>
<p><code>field_type</code> - type of the field</p>
<p><code>min_version</code> - Ucs server release in which the property was first introduced</p>
<p><code>access</code> - defines if a property is interal/user-readable/user-writable</p>
<p>property restrictions: <br>
<code>min_length</code> - minimum length for string property type</p>
<p><code>max_length</code> - maximum length for string property type</p>
<p><code>pattern</code> - allowed patterns, regexs</p>
<p><code>value_set</code> - set of allowed values for this property</p>
<p><code>range_val</code> - range for int/uint values</p>
<pre><code>In [7]: class_meta = get_meta_info("FabricVlan")
In [8]: print class_meta
[FabricEthEstc]
[FabricEthEstcCloud]
[FabricEthLan]
[FabricLanCloud]
|-FabricVlan
|-FabricEthMonFiltEp
|-FabricEthMonSrcEp
|-FabricEthVlanPc
| |-FaultInst
|-FabricEthVlanPortEp
| |-FaultInst
|-FabricPoolableVlan
|-FabricSwSubGroup
| |-FabricEthVlanPortEp
| | |-FaultInst
| |-FabricFcoeVsanPortEp
| |-FaultInst
|-FaultInst
ClassId FabricVlan
------- ----------
xml_attribute :fabricVlan
rn :net-[name]
min_version :1.0(1e)
access :InputOutput
access_privilege :['admin', 'ext-lan-config', 'ext-lan-policy']
parents :[u'fabricEthEstc', u'fabricEthEstcCloud', u'fabricEthLan', u'fabricLanCloud']
children :[u'fabricEthMonFiltEp', u'fabricEthMonSrcEp', u'fabricEthVlanPc', u'fabricEthVlanPortEp', u'fabricPoolableVlan', u'fabricSwSubGroup', u'faultInst']
Property assoc_primary_vlan_state
-------- ------------------------
xml_attribute :assocPrimaryVlanState
field_type :string
min_version :2.2(2c)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['does-not-exists', 'is-empty', 'is-in-error-state', 'is-not-primary-type', 'ok']
range_val :[]
Property assoc_primary_vlan_switch_id
-------- ----------------------------
xml_attribute :assocPrimaryVlanSwitchId
field_type :string
min_version :2.2(2c)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['A', 'B', 'NONE']
range_val :[]
Property child_action
-------- ------------
xml_attribute :childAction
field_type :string
min_version :1.0(1e)
access :INTERNAL
min_length :None
max_length :None
pattern :((deleteAll|ignore|deleteNonPresent),){0,2}(deleteAll|ignore|deleteNonPresent){0,1}
value_set :[]
range_val :[]
Property cloud
-------- -----
xml_attribute :cloud
field_type :string
min_version :2.1(1a)
access :READ_ONLY
min_length :None
max_length :None
pattern :((defaultValue|unknown|fcsanmon|ethlan|ethestclan|fcestc|ethlanmon|fcsan),){0,7}(defaultValue|unknown|fcsanmon|ethlan|ethestclan|fcestc|ethlanmon|fcsan){0,1}
value_set :[]
range_val :[]
Property compression_type
-------- ----------------
xml_attribute :compressionType
field_type :string
min_version :2.1(1a)
access :READ_WRITE
min_length :None
max_length :None
pattern :None
value_set :['excluded', 'included']
range_val :[]
Property config_issues
-------- -------------
xml_attribute :configIssues
field_type :string
min_version :2.1(1a)
access :READ_ONLY
min_length :None
max_length :None
pattern :((defaultValue|not-applicable|conflicting-vlan-access|unsupported-multicast-policy),){0,3}(defaultValue|not-applicable|conflicting-vlan-access|unsupported-multicast-policy){0,1}
value_set :[]
range_val :[]
Property default_net
-------- -----------
xml_attribute :defaultNet
field_type :string
min_version :1.0(1e)
access :READ_WRITE
min_length :None
max_length :None
pattern :None
value_set :['false', 'no', 'true', 'yes']
range_val :[]
Property dn
-------- --
xml_attribute :dn
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :0
max_length :256
pattern :None
value_set :[]
range_val :[]
Property ep_dn
-------- -----
xml_attribute :epDn
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :0
max_length :256
pattern :None
value_set :[]
range_val :[]
Property flt_aggr
-------- --------
xml_attribute :fltAggr
field_type :ulong
min_version :2.1(1a)
access :INTERNAL
min_length :None
max_length :None
pattern :None
value_set :[]
range_val :[]
Property id
-------- --
xml_attribute :id
field_type :uint
min_version :1.0(1e)
access :READ_WRITE
min_length :None
max_length :None
pattern :None
value_set :[]
range_val :['1-4029', '4048-4093']
Property if_role
-------- -------
xml_attribute :ifRole
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['diag', 'fcoe-nas-storage', 'fcoe-storage', 'fcoe-uplink', 'mgmt', 'monitor', 'nas-storage', 'network', 'network-fcoe-uplink', 'server', 'service', 'storage', 'unknown']
range_val :[]
Property if_type
-------- -------
xml_attribute :ifType
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['aggregation', 'physical', 'unknown', 'virtual']
range_val :[]
Property local
-------- -----
xml_attribute :local
field_type :ulong
min_version :2.1(2a)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :[]
range_val :[]
Property locale
-------- ------
xml_attribute :locale
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :None
max_length :None
pattern :((defaultValue|unknown|server|chassis|internal|external),){0,5}(defaultValue|unknown|server|chassis|internal|external){0,1}
value_set :[]
range_val :[]
Property mcast_policy_name
-------- -----------------
xml_attribute :mcastPolicyName
field_type :string
min_version :2.1(1a)
access :READ_WRITE
min_length :None
max_length :None
pattern :[\-\.:_a-zA-Z0-9]{0,16}
value_set :[]
range_val :[]
Property name
-------- ----
xml_attribute :name
field_type :string
min_version :1.0(1e)
access :NAMING
min_length :None
max_length :None
pattern :[\-\.:_a-zA-Z0-9]{1,32}
value_set :[]
range_val :[]
Property oper_mcast_policy_name
-------- ----------------------
xml_attribute :operMcastPolicyName
field_type :string
min_version :2.1(1a)
access :READ_ONLY
min_length :0
max_length :256
pattern :None
value_set :[]
range_val :[]
Property oper_state
-------- ----------
xml_attribute :operState
field_type :string
min_version :2.0(1m)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['error-misconfigured', 'ok']
range_val :[]
Property overlap_state_for_a
-------- -------------------
xml_attribute :overlapStateForA
field_type :string
min_version :2.2(2c)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['active', 'not-active', 'ok', 'primary-id-mismatch', 'sharing-type-mismatch']
range_val :[]
Property overlap_state_for_b
-------- -------------------
xml_attribute :overlapStateForB
field_type :string
min_version :2.2(2c)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['active', 'not-active', 'ok', 'primary-id-mismatch', 'sharing-type-mismatch']
range_val :[]
Property peer_dn
-------- -------
xml_attribute :peerDn
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :0
max_length :256
pattern :None
value_set :[]
range_val :[]
Property policy_owner
-------- ------------
xml_attribute :policyOwner
field_type :string
min_version :2.1(2a)
access :READ_WRITE
min_length :None
max_length :None
pattern :None
value_set :['local', 'pending-policy', 'policy']
range_val :[]
Property pub_nw_dn
-------- ---------
xml_attribute :pubNwDn
field_type :string
min_version :1.4(1i)
access :READ_ONLY
min_length :0
max_length :256
pattern :None
value_set :[]
range_val :[]
Property pub_nw_id
-------- ---------
xml_attribute :pubNwId
field_type :uint
min_version :1.4(1i)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :[]
range_val :[]
Property pub_nw_name
-------- -----------
xml_attribute :pubNwName
field_type :string
min_version :1.4(1i)
access :READ_WRITE
min_length :0
max_length :510
pattern :None
value_set :[]
range_val :[]
Property r_global
-------- --------
xml_attribute :global
field_type :ulong
min_version :2.1(2a)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :[]
range_val :[]
Property rn
-------- --
xml_attribute :rn
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :0
max_length :256
pattern :None
value_set :[]
range_val :[]
Property sacl
-------- ----
xml_attribute :sacl
field_type :string
min_version :3.0(2a)
access :READ_ONLY
min_length :None
max_length :None
pattern :((none|del|mod|addchild|cascade),){0,4}(none|del|mod|addchild|cascade){0,1}
value_set :[]
range_val :[]
Property sharing
-------- -------
xml_attribute :sharing
field_type :string
min_version :1.4(1i)
access :READ_WRITE
min_length :None
max_length :None
pattern :None
value_set :['community', 'isolated', 'none', 'primary']
range_val :[]
Property status
-------- ------
xml_attribute :status
field_type :string
min_version :1.0(1e)
access :READ_WRITE
min_length :None
max_length :None
pattern :((removed|created|modified|deleted),){0,3}(removed|created|modified|deleted){0,1}
value_set :[]
range_val :[]
Property switch_id
-------- ---------
xml_attribute :switchId
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :None
max_length :None
pattern :None
value_set :['A', 'B', 'NONE', 'dual']
range_val :[]
Property transport
-------- ---------
xml_attribute :transport
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :None
max_length :None
pattern :((defaultValue|unknown|ether|dce|fc),){0,4}(defaultValue|unknown|ether|dce|fc){0,1}
value_set :[]
range_val :[]
Property type
-------- ----
xml_attribute :type
field_type :string
min_version :1.0(1e)
access :READ_ONLY
min_length :None
max_length :None
pattern :((defaultValue|unknown|lan|san|ipc),){0,4}(defaultValue|unknown|lan|san|ipc){0,1}
value_set :[]
range_val :[]
</code></pre>]]></content:encoded></item><item><title><![CDATA[Multiple parallel transactions - ucsmsdk 0.9.1.1]]></title><description><![CDATA[<p>Until <code>ucsmsdk</code> 0.9.1.0 everything until a <code>handle.commit</code> was a single transaction,</p>
<pre><code>handle.add_mo(mo1)
handle.add_mo(mo2)
handle.remove_mo(mo3)
handle.commit()
</code></pre>
<p>Starting 0.9.1.1 there is an optional <code>tag</code> parameter added to <code>add_mo</code>,<code>set_mo</code>,<code>remove_mo</code>,<code>commit</code>. <code>tag</code></p>]]></description><link>http://localhost:2368/multiple-parallel-transactions-ucsmsdk-0-9-1-1/</link><guid isPermaLink="false">1d7533c5-68a6-45e3-ab91-622692bd10a0</guid><category><![CDATA[ucsmsdk]]></category><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 23:03:23 GMT</pubDate><content:encoded><![CDATA[<p>Until <code>ucsmsdk</code> 0.9.1.0 everything until a <code>handle.commit</code> was a single transaction,</p>
<pre><code>handle.add_mo(mo1)
handle.add_mo(mo2)
handle.remove_mo(mo3)
handle.commit()
</code></pre>
<p>Starting 0.9.1.1 there is an optional <code>tag</code> parameter added to <code>add_mo</code>,<code>set_mo</code>,<code>remove_mo</code>,<code>commit</code>. <code>tag</code> is the scope of a transaction.</p>
<p>So, here is how two parallel transactions can be done. </p>
<pre><code>handle.add_mo(mo1, tag="trans_1")
handle.add_mo(mo2, tag="trans_2")
handle.add_mo(mo3, tag="trans_1")
handle.remove_mo(mo4, tag="trans_2")
# Commit transaction #2
handle.commit(tag="trans_2")
handle.add_mo(mo5, tag="trans_1")
# Commit transaction #1
handle.commit(tag="trans_1")
</code></pre>
<p>use case: if we wanted to use the same handle object in different threads, the thread.name could be passed as the tag parameter. This would ensure that operations in one thread do not affect others.</p>
<p>Without the tag parameter the behaviour is as it was in 0.9.1.0</p>]]></content:encoded></item><item><title><![CDATA[Polling for a specific event ucsmsdk.]]></title><description><![CDATA[<p>Optional poll mode is added to wait<em>for</em>event API</p>
<p>The below code will wait for the <code>usr_lbl</code> property of the service profile <code>org-root/ls-demo-sp</code> to change to <code>demo_label</code>. It will poll the server every poll_sec=10 here. It will timeout after 600 seconds.</p>
<p><code>wait_for_event</code></p>]]></description><link>http://localhost:2368/polling-for-a-specific-event-ucsmsdk/</link><guid isPermaLink="false">634fffee-771e-4689-86c5-a33ee4731ec8</guid><category><![CDATA[ucsmsdk]]></category><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 23:01:12 GMT</pubDate><content:encoded><![CDATA[<p>Optional poll mode is added to wait<em>for</em>event API</p>
<p>The below code will wait for the <code>usr_lbl</code> property of the service profile <code>org-root/ls-demo-sp</code> to change to <code>demo_label</code>. It will poll the server every poll_sec=10 here. It will timeout after 600 seconds.</p>
<p><code>wait_for_event</code> will keep the script alive until (i) either the condition is met or (ii) timeout is triggered</p>
<pre><code>from ucsmsdk.ucshandle import UcsHandle
def usr_label_changed(mce):
print(mce.mo.usr_label)
handle.logout()
handle = UcsHandle("192.168.1.1", "username", "password")
handle.login()
sp_mo = handle.query_dn("org-root/ls-demo-sp")
handle.wait_for_event(
mo=sp_mo,
prop="usr_lbl",
value="demo_label",
cb=usr_label_changed,
timeout=600,
poll_sec=10
)
</code></pre>]]></content:encoded></item><item><title><![CDATA[docker - failed to set link up: address already in use]]></title><description><![CDATA[<p>Noticed the following error message while trying to bring up Docker DTR container.</p>
<pre><code>FATA[0003] Error response from daemon: subnet sandbox join failed for "10.1.0.0/24": vxlan interface creation failed for subnet "10.1.0.0/24": failed to set link up: address already in use
I</code></pre>]]></description><link>http://localhost:2368/docker-failed-to-set-link-up-address-already-in-use/</link><guid isPermaLink="false">a68e0388-a542-44cd-9a47-69606a236cc3</guid><category><![CDATA[docker]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 22:59:57 GMT</pubDate><content:encoded><![CDATA[<p>Noticed the following error message while trying to bring up Docker DTR container.</p>
<pre><code>FATA[0003] Error response from daemon: subnet sandbox join failed for "10.1.0.0/24": vxlan interface creation failed for subnet "10.1.0.0/24": failed to set link up: address already in use
I went on a wild-goose chase trying to figure out who was using 10.1.0.0/24. It turns out that it was caused due to the 4789 UDP port conflict that VXLAN uses.
</code></pre>
<p>Both Docker overlay and Contiv overlay use VXLAN and use the same port. In this specific scenario Contiv was already using port 4789, and so the failure was seen while configuring a docker overlay network.</p>
<p>Takeaway: The error message should probably be enhanced to point out the port conflict.</p>]]></content:encoded></item><item><title><![CDATA[ucsmsdk offline pip install with dependencies]]></title><description><![CDATA[<p>The server you want to install the SDK on sometimes might not have internet connectivity. <br>
The following facilitate a offline install,</p>
<p>On a machine with internet connectivity (this could be your PC or Mac), </p>
<pre><code>pip install --download /path/to/save/dependencies
</code></pre>
<ul>
<li>Now copy /path/to/save/dependencies to the server</li></ul>]]></description><link>http://localhost:2368/ucsmsdk-offline-pip-install-with-dependencies/</link><guid isPermaLink="false">292b9255-f0a8-458c-b659-d4097fc2654f</guid><category><![CDATA[ucsmsdk]]></category><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 22:59:16 GMT</pubDate><content:encoded><![CDATA[<p>The server you want to install the SDK on sometimes might not have internet connectivity. <br>
The following facilitate a offline install,</p>
<p>On a machine with internet connectivity (this could be your PC or Mac), </p>
<pre><code>pip install --download /path/to/save/dependencies
</code></pre>
<ul>
<li>Now copy /path/to/save/dependencies to the server that does not have internet access.</li>
<li>The SDK can now be installed offline using,</li>
</ul>
<pre><code>pip install --no-index --find-links /path/to/save/dependencies
</code></pre>
<p>Example:</p>
<pre><code>➜ ~ pip install ucsmsdk --download /tmp/ucsmsdk
DEPRECATION: pip install --download has been deprecated and will be removed in the future. Pip now has a download command that should be used instead.
Collecting ucsmsdk
Downloading ucsmsdk-0.9.1.1-py2.py3-none-any.whl (5.9MB)
100% |████████████████████████████████| 5.9MB 218kB/s
Saved /tmp/ucsmsdk/ucsmsdk-0.9.1.1-py2.py3-none-any.whl
Collecting pyparsing (from ucsmsdk)
Using cached pyparsing-2.1.5-py2.py3-none-any.whl
Saved /tmp/ucsmsdk/pyparsing-2.1.5-py2.py3-none-any.whl
Successfully downloaded ucsmsdk pyparsing
➜ ~
➜ ~ ls -l /tmp/ucsmsdk
total 11552
-rw-r--r-- 1 vvb wheel 42540 Jul 20 10:16 pyparsing-2.1.5-py2.py3-none-any.whl
-rw-r--r-- 1 vvb wheel 5867759 Jul 20 10:16 ucsmsdk-0.9.1.1-py2.py3-none-any.whl
➜ ~
➜ ~ sudo pip install ~/work/tpi/release/ucsmsdk/dist/ucsmsdk-0.9.1.1.tar.gz --no-index --find-links /tmp/ucsmsdk
The directory '/Users/vvb/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Ignoring indexes: https://pypi.python.org/simple
The directory '/Users/vvb/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Processing ./work/tpi/release/ucsmsdk/dist/ucsmsdk-0.9.1.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pyparsing in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from ucsmsdk==0.9.1.1)
Installing collected packages: ucsmsdk
Found existing installation: ucsmsdk 0.9.1.0
Uninstalling ucsmsdk-0.9.1.0:
Successfully uninstalled ucsmsdk-0.9.1.0
Running setup.py install for ucsmsdk ... done
Successfully installed ucsmsdk-0.9.1.1
➜ ~
</code></pre>]]></content:encoded></item><item><title><![CDATA[checking if a docker container is running]]></title><description><![CDATA[<p>The following will return true if the container is running and false otherwise.</p>
<p><code>docker inspect -f {{.State.Running}} "$container_id"</code></p>
<p>The following fetches container id based on it's name,</p>
<pre><code>name=alpine
count=$(docker ps | grep "$name" | wc -l)
if [ $count == 1 ]; then
id=$(docker ps | grep "$name" | cut -d '</code></pre>]]></description><link>http://localhost:2368/checking-if-a-docker-container-is-running/</link><guid isPermaLink="false">6cae6391-db69-43b6-b7a8-080f38bafd5a</guid><category><![CDATA[docker]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 22:57:28 GMT</pubDate><content:encoded><![CDATA[<p>The following will return true if the container is running and false otherwise.</p>
<p><code>docker inspect -f {{.State.Running}} "$container_id"</code></p>
<p>The following fetches container id based on it's name,</p>
<pre><code>name=alpine
count=$(docker ps | grep "$name" | wc -l)
if [ $count == 1 ]; then
id=$(docker ps | grep "$name" | cut -d ' ' -f 1)
echo "$container_id"
elif [ $count == 0 ]; then
echo "No container with name $name"
else
echo "more than one container with name $name"
fi
</code></pre>
<p>note: In the above example we use docker ps and not docker ps -a. So, we can already assume that the containers it returns are in running state.</p>]]></content:encoded></item><item><title><![CDATA[Ucs config backup to Python script - ucsmsdk]]></title><description><![CDATA[<p><code>ucmsdk</code> in version 0.9.2.0 will add the ability of being able to generate a python script for configuring Ucs server based on a config state backup XML.</p>
<p><code>convert_from_backup(backup_file, output_file=None)</code></p>
<p><code>backup_file</code> - needs to a config backup XML downloaded from a</p>]]></description><link>http://localhost:2368/ucs-config-backup-to-python-script-ucsmsdk/</link><guid isPermaLink="false">b03c3364-2252-4cab-b570-12f3aef89c23</guid><category><![CDATA[ucsmsdk]]></category><category><![CDATA[ucspython]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 22:56:33 GMT</pubDate><content:encoded><![CDATA[<p><code>ucmsdk</code> in version 0.9.2.0 will add the ability of being able to generate a python script for configuring Ucs server based on a config state backup XML.</p>
<p><code>convert_from_backup(backup_file, output_file=None)</code></p>
<p><code>backup_file</code> - needs to a config backup XML downloaded from a UCS server.</p>
<p><code>output_file</code> - file where the equivalent python script is desired.</p>
<p>Example usage:</p>
<pre><code>from ucsmsdk.utils.convertfrombackup import convert_from_backup
convert_from_backup(backup_file="/Users/vvb/configbackup.xml", output_file="/Users/vvb/ucs_config.py")
</code></pre>
<p>Without the output_file argument, the output is redirected to stdout.</p>
<p>Usage:</p>
<p>Below is a very small part of the config backup xml, </p>
<pre><code><?xml version="1.0" ?>
<topRoot>
<topMetaInf ecode="E001" name="meta-sec"/>
<orgOrg descr="" name="root">
<lsbootPolicy bootMode="legacy" descr="" enforceVnicName="yes" name="new_boot_pol" policyOwner="local" purpose="operational" rebootOnUpdate="no">
<lsbootVirtualMedia access="read-only-remote-cimc" lunId="0" mappingName="" order="1"/>
<lsbootVirtualMedia access="read-only-local" lunId="0" mappingName="" order="2"/>
<lsbootStorage order="3">
<lsbootLocalStorage>
<lsbootUsbFlashStorageImage order="3"/>
</lsbootLocalStorage>
</lsbootStorage>
</lsbootPolicy>
</orgOrg>
</topRoot>
</code></pre>
<p>will be converted into</p>
<pre><code>#!/usr/bin/env python
from ucsmsdk.ucshandle import UcsHandle
handle = UcsHandle(ip="", username="", password="")
handle.login()
from ucsmsdk.mometa.lsboot.LsbootPolicy import LsbootPolicy
from ucsmsdk.mometa.lsboot.LsbootVirtualMedia import LsbootVirtualMedia
from ucsmsdk.mometa.lsboot.LsbootStorage import LsbootStorage
from ucsmsdk.mometa.lsboot.LsbootLocalStorage import LsbootLocalStorage
from ucsmsdk.mometa.lsboot.LsbootUsbFlashStorageImage import LsbootUsbFlashStorageImage
mo = LsbootPolicy(parent_mo_or_dn=obj, name="new_boot_pol", reboot_on_update="no", policy_owner="local", purpose="operational", enforce_vnic_name="yes", boot_mode="legacy")
mo_1 = LsbootVirtualMedia(parent_mo_or_dn=mo, access="read-only-remote-cimc", lun_id="0", order="1")
mo_2 = LsbootVirtualMedia(parent_mo_or_dn=mo, access="read-only-local", lun_id="0", order="2")
mo_3 = LsbootStorage(parent_mo_or_dn=mo, order="3")
mo_4 = LsbootLocalStorage(parent_mo_or_dn=mo_3, )
mo_5 = LsbootUsbFlashStorageImage(parent_mo_or_dn=mo_4, order="3")
handle.add_mo(mo, True)
handle.commit()
handle.logout()
</code></pre>]]></content:encoded></item><item><title><![CDATA[Contiv Volplugin Rate limiting - Runtime]]></title><description><![CDATA[<p>One of the coolest features of Contiv volplugin is the ability to modify volume iops,bps resource restrictions on the fly.</p>
<p>This is facilitated by, <br>
volcli volume runtime upload policy/volume < restrictions.json</p>
<p><code>policy/volume</code> - policy name /volume name
<code>restrictions.json</code> - JSON file with resource restrictions</p>
<p>The</p>]]></description><link>http://localhost:2368/contiv-volplugin-rate-limiting-runtime/</link><guid isPermaLink="false">8fa44984-6575-40f4-816a-8f8410299d05</guid><category><![CDATA[contiv]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 22:54:50 GMT</pubDate><content:encoded><![CDATA[<p>One of the coolest features of Contiv volplugin is the ability to modify volume iops,bps resource restrictions on the fly.</p>
<p>This is facilitated by, <br>
volcli volume runtime upload policy/volume < restrictions.json</p>
<p><code>policy/volume</code> - policy name /volume name
<code>restrictions.json</code> - JSON file with resource restrictions</p>
<p>The entire flow..</p>
<p>Create a policy</p>
<p><code>volcli policy upload policy1 < policy1.json</code></p>
<p>Create a volume</p>
<p><code>volcli volume create policy1/volume1</code></p>
<p>Attach this volume to a container</p>
<p><code>docker run -it -v policy1/volume1:/mntpath ubuntu /bin/bash</code></p>
<p>So, now that the volume is attached - you can still modify the ios/bps on it via volcli</p>
<p>Create a JSON file - restrictions.json, </p>
<pre><code> {
"rate-limit": {
"write-bps": 1000,
"read-bps": 10
}
}
</code></pre>
<p>Upload the new restrictions,</p>
<p><code>volcli volume runtime upload policy1/volume1 < restrictions.json</code></p>
<p>Done - the new restrictions are active now!</p>]]></content:encoded></item><item><title><![CDATA[vagrant 1.8.5 ssh failures!]]></title><description><![CDATA[<p>Vagrant 1.8.5 throws the below error when doing a vagrant up</p>
<pre><code>default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning:</code></pre>]]></description><link>http://localhost:2368/vagrant-1-8-5-ssh-failures/</link><guid isPermaLink="false">f37b79ec-4a2b-49b4-800e-984c295073ae</guid><category><![CDATA[vagrant]]></category><dc:creator><![CDATA[vvb]]></dc:creator><pubDate>Mon, 07 Nov 2016 22:52:52 GMT</pubDate><content:encoded><![CDATA[<p>Vagrant 1.8.5 throws the below error when doing a vagrant up</p>
<pre><code>default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
</code></pre>