opentelekomcloud / python-otcclient

(Obsolete) Python bindings to the T-Systems OTC API
MIT License
15 stars 20 forks source link

Issue with network_id returning instead of subnet id #44

Closed mattbarrio closed 7 years ago

mattbarrio commented 7 years ago

ISSUE When creating/describing a subnet the id that is returned is the network_id and not the id of the actual subnet.

STEPS TO REPRODUCE

  1. create subnet via otc client

root# otc ecs create-subnet --subnet-name ${ENV_NAME}-01 --cidr ${SUBNET_1_CIDR_BLOCK} --gateway-ip ${SUBNET_1_GATEWAY_IP} --primary-dns ${PRIMARY_DNS} --secondary-dns ${SECONDARY_DNS} --availability-zone eu-de-01 --vpc-name ${ENV_NAME}-vpc

>{"subnet":{"id":"4907224f-c12c-45bd-9f9a-18c99ec20a26","name":"ol-staging-01","cidr":"192.168.1.0/24","status":"UNKNOWN","vpc_id":"2c24c98d-7970-4506-b627-812c13ae8521","gateway_ip":"192.168.1.1","dhcp_enable":true,"primary_dns":"100.125.4.25","secondary_dns":"8.8.8.8","availability_zone":"eu-de-01"}}

root# otc ecs describe-subnets >| status | name | availability_zone | primary_dns | gateway_ip | vpc_id | cidr | id | ACTIVE | ol-staging-01 | eu-de-01 | 100.125.4.25 | 192.168.1.1 | 2c24c98d-7970-4506-b627-812c13ae8521 | 192.168.1.0/24 | 4907224f-c12c-45bd-9f9a-18c99ec20a26 |

  1. Checking this via the openstack cli the correct id and network id are returned

root# openstack subnet list
>| ID | Name | Network | Subnet | | 2e580847-e14e-4f8b-bdfd-e1fde65dda97 | ol-staging-01 | 4907224f-c12c-45bd-9f9a-18c99ec20a26 | 192.168.1.0/24 |

When sending delete to the endpoint with the network id this fails, 1) because there is a port attached to the subnet (seems to be the gateway_ip?) 2) because there is no subnet with the id of network id.

Anywork around with the native openstack client or thoughts about fixes on the otc client? I tried to delete the port via openstack cli but ended with error because of the device-owner=network:dhcp and didn't want to orphan any objects by removing that.

hodigy commented 7 years ago

OTC Api reference contains the API call that otc client uses in chapter 4.3: GET /v1/{tenant_id}/subnets https://docs.otc.t-systems.com/en-us/vpc_dld/index.html I'm checking openstack client for it's call details.

hodigy commented 7 years ago

openstack client uses another api version. curl -g -i -X GET https://vpc.eu-de.otctest.t-systems.com/v2.0/subnets

hodigy commented 7 years ago

There were problems with the otc delete-subnet command, that has been fixed in pull request https://github.com/OpenTelekomCloud/python-otcclient/pull/50

Please note that VPC is mandatory parameter of the delete.

Is there additional issues or that was it?

zsoltn commented 7 years ago

Fixed with f57118cb61f63a7f1969c11ad28dc096573eba61.