vmware-archive / vcd-cli

Command Line Interface for VMware vCloud Director
https://vmware.github.io/vcd-cli
Other
165 stars 105 forks source link

Specifying a static ip address for an edge gateway doesn't work #499

Open d3m1g0d opened 4 years ago

d3m1g0d commented 4 years ago

IP addresses of edge gateways always seem to be auto generated.

Procedure to reproduce issue:

PS> vcd gateway create --external-network tsa-vcd-testdrive-inet_extnet_375 --configure-ip-setting tsa-vcd-testdrive-inet_extnet_375 172.31.199.0/24 172.31.199.133 testorg_gw_01
networkEdgeGatewayCreate: Creating EdgeGateway testorg_gw_01(fb2598f3-c5b3-4038-a296-381fcf102049)
networkEdgeGatewayCreate: Creating EdgeGateway testorg_gw_01(fb2598f3-c5b3-4038-a296-381fcf102049)
task: 687009f3-e60a-47ab-94e2-d3e4a5e6953d, Created EdgeGateway testorg_gw_01(fb2598f3-c5b3-4038-a296-381fcf102049), result: success
PS> vcd gateway info testorg_gw_01
property                         value
-------------------------------  ----------------------------------------------------
external_network_ip_allocations  tsa-vcd-testdrive-inet_extnet_375: ['172.31.199.20']
PS> vcd version
vcd-cli, VMware vCloud Director Command Line Interface, 22.0.0
d3m1g0d commented 4 years ago

Also editing the IP address later on doesn't work:

PS> vcd gateway configure-ip-settings --external-network tsa-vcd-testdrive-inet_extnet_375 --subnet-available 172.31.199.0/24 True 172.31.199.133 testorg_gw_01
Usage: vcd gateway configure-ip-settings [OPTIONS] <gateway name>
Try "vcd gateway configure-ip-settings -h" for help.

Error: Subnet not found
PS> vcd info edgeGateway fb2598f3-c5b3-4038-a296-381fcf102049
<EdgeGateway xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" 
...
  <GatewayBackingRef>
    <gatewayId>edge-174</gatewayId>
    <VCRef id="4b99acd1-2030-46f0-9540-fab500391673" name="" type="com.vmware.vcloud.entity.vimserver"/>
  </GatewayBackingRef>
  <Configuration>
    <GatewayBackingConfig>compact</GatewayBackingConfig>
    <GatewayInterfaces>
      <GatewayInterface>
        <Name>tsa-vcd-testdrive-inet_extnet_375</Name>
        <DisplayName>tsa-vcd-testdrive-inet_extnet_375</DisplayName>
        <Network href="https://.../api/admin/network/bea44c2e-92cc-41ed-8609-09db0edd61c2" name="tsa-vcd-testdrive-inet_extnet_375" type="application/vnd.vmware.admin.network+xml"/>
        <InterfaceType>uplink</InterfaceType>
        <SubnetParticipation>
          <Gateway>172.31.199.1</Gateway>
          <Netmask>255.255.255.0</Netmask>
          <IpAddress>172.31.199.20</IpAddress>
          <UseForDefaultRoute>false</UseForDefaultRoute>
        </SubnetParticipation>
        <ApplyRateLimit>false</ApplyRateLimit>
        <UseForDefaultRoute>false</UseForDefaultRoute>
      </GatewayInterface>
    </GatewayInterfaces>
...
  </Configuration>
</EdgeGateway>
mbhajare commented 4 years ago

Sample example is given on the below URL about how to give static IP to an edge gateway: https://github.com/vmware/ansible-module-vcloud-director/blob/master/modules/vcd_vdc_gateway.py

Look at the like number 200.