cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Error when configure IP address

125
Views
0
Helpful
0
Comments
Advisor
This document was generated from CDN thread

Created by: Dan Nel on 29-08-2013 08:37:01 PM
Hope someone knows why this command doesnt work.

Subject: RE: Error when configure IP address
Replied by: Dan Nel on 29-08-2013 10:32:15 PM
I tried the following command but the command cant find the service profile, and thats because the service profile is not under root, its under a sub-organisation called ORG. The commnad looks at org-root/ls-Dummy1/ipv4-static-addr. How do I modify the command, so it can find the service profile which is under org-root/org-ORG/ls-Dummy1/ipv4-static-addr


PS D:\cisco> Add-UcsVnicIpV4StaticAddr -ServiceProfile Dummy1 -Addr 10.65.224.161 -DefGw 10.65.224.1 -subnet 255.255.255.0
Add-UcsVnicIpV4StaticAddr : clay-ncs-pod07:configured object (org-root/ls-Dummy1/ipv4-static-addr) not found
At line:1 char:26
+ Add-UcsVnicIpV4StaticAddr <<<<  -ServiceProfile Dummy1 -Addr 10.65.224.161 -DefGw 10.65.224.1 -su
bnet 255.255.255.0
    + CategoryInfo          : ObjectNotFound: (unidentified-fail:String) [Add-UcsVnicIpV4StaticAdd
   r], Exception
    + FullyQualifiedErrorId : 102,Cisco.Ucs.Cmdlets.AddUcsVnicIpV4StaticAddr

Subject: RE: Error when configure IP address
Replied by: Eric Williams on 30-08-2013 08:52:27 AM
I have a couple ways you can do this.  First off, do you know of the cmdlet -> convertto-ucscmdlet.  It monitors the UCS Manager Java GUI running on your laptop / jump host and will monitor the Java GUI log file for configuration changes.  When it finds a configuration change, it will convert the XML output to PowerShell cmdlets.  That way, you can do your configuration changes in the Java GUI, and have it write your code for you.

Note:  I recommend you do these changes against a UCS Platform Emulator, as it doesn't filter anything out it logs.  On a real system, you will need to connect to the UCS Domain via PowerTool, and run "start-ucsguisession -LogAllXml".  The -LogAllXml parameter will tell the GUI to log most operations.

$sp = Get-UcsOrg -Level root  | Get-UcsServiceProfile  -Name "test" -LimitScope
$devnull = $sp | Add-UcsVnicIpV4StaticAddr -ModifyPresent -Addr "1.2.3.4" -DefGw "1.2.3.1" -Subnet "255.255.255.0"

In your case, you need to do the following:

$sp = Get-UcsOrg -Dn org-root/org-Org | Get-UcsServiceProfile  -Name "Dummy1" -LimitScope
$devnull = $sp | Add-UcsVnicIpV4StaticAddr -ModifyPresent -Addr "10.65.224.161" -DefGw "10.65.224.1" -Subnet "255.255.255.0"

The problem with your first one, is you didn't pipeline a SP into the Add-UcsVnicIpV4StaticAddr example.  Every cmdlet has objects that can be pipelined into.  Like for this cmdlet:

PS C:\> Get-UcsCmdletMeta -noun UcsVnicIpv4StaticAddr

ClassId                   : VnicIpV4StaticAddr
Noun                      : UcsVnicIpV4StaticAddr
Verb                      : Get, Add, Set, Remove
PipelineClassId           : {AdaptorHostIscsiIf, AdaptorVlan, LsServer, LsbootLanImagePath...}
LimitScopePipelineClassId : {AdaptorHostIscsiIf, LsServer}
MoMeta                    : Cisco.Ucs.UcsMoMeta

PS C:\> Get-UcsCmdletMeta -noun UcsVnicIpv4StaticAddr | select -ExpandProperty Pipelineclassid
AdaptorHostIscsiIf
AdaptorVlan
LsServer
LsbootLanImagePath
MgmtControllerVnicIPv4If

So those are the classes that can be pipelined into it.  The Org class can't be pipeline into to this cmdlet.  You need to define the scope of what the Add cmdlet you were providing would do.  If you wanted to do it all in one line it would be:

$devnull = Get-UcsOrg -Dn org-root/org-Org | Get-UcsServiceProfile  -Name "Dummy1" -LimitScope | Add-UcsVnicIpV4StaticAddr -ModifyPresent -Addr "10.65.224.161" -DefGw "10.65.224.1" -Subnet "255.255.255.0"

In that example, the SP is pipelined into the Add-UcsVnicIpV4StaticAddr cmdlet.  You could also do it like this:

$devnull =  Add-UcsVnicIpV4StaticAddr -ModifyPresent -Addr "10.65.224.161" -DefGw "10.65.224.1" -Subnet "255.255.255.0" -ServiceProfile (Get-UcsOrg -Dn org-root/org-Org | Get-UcsServiceProfile  -Name "Dummy1" -LimitScope )

Let me know if that helps.
Eric
CreatePlease to create content