Some devices don’t have an API yet, but do have an ssh command line. So of course you can use expect to automate that device. Recently while writing PowerShell code to automate Nexus 1000V port-profile provisioning using Cygwin expect and ssh I ran into a problem with the allowed vlan list associated to a trunk.
The list came across as comma separated and range hyphenated. I needed to turn the list into a fully expanded comma separated list.
For each string, if there is a hyphen in the string then create a new object that replaces the hyphen with the range operator .. using the Substring and IndexOf methods of the input string.
Go from 610-614 to 610..614, when PowerShell passes this to the next foreach it becomes
Interestingly the string method Replace does not cause PowerShell to expanded 610..614 it simply sees it as another string. Whereas building the string as shown in the command above causes the desired effect.
If no hyphen is found in the string then just pass it though.
285 -> goes through as 285
Next build the $tmp string which is a comma separated list of the expanded vlans
% is an alias for ForEach-Object and ForEach-Object supports a Begin, Process, and End script block.
I can set the $tmp string to “” or nothing in the Begin scriptblock of the ForEach-Object process, then the Process scriptblock builds the $tmp string by either setting $tmp to the first vlan when $tmp length is equal to 0 (zero) or by appending a “,” and then the next vlan when $tmp length is longer than 0. Finally after all the ForEach-Object objects have been processed the End scriptblock prints out $tmp. The result is…
Is there anything special I have to do on VMware to get two 9000v's setup as a vPC pair? When I build the vPC, the link will come up and then throw the log up below and block all VLAN's from traversing the peer-link. If I put the same config o...
Dear friends, I am struggling to understand difference between extending EPG vs extending BD in normal SINGLE POD case-1 As i understood so far, Extending EPG means we will make EPG-10 and will add trunk ports in it (trunk port going ...
This may be the wrong place to post this question but I'm having a weird issue accessing the APIC GUI from my home internet. When on my ISPs service, I cannot access the GUI of any of my companies APICs. I can only ping the APIC IP with a max MTU size of ...