Skip to content

Commit

Permalink
add namespace methods to nautobot client
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Fencik committed Dec 5, 2024
1 parent fe3d2ea commit d23a242
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/neutron-understack/neutron_understack/nautobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ def ucvni_delete(self, network_id):
url = f"/api/plugins/undercloud-vni/ucvnis/{network_id}/"
return self.make_api_request(url, "delete")

def fetch_namespace_by_name(self, name: str) -> str:
url = f"/api/ipam/namespaces/?name={name}&depth=1"
resp_data = self.make_api_request(url, "get")
return resp_data["results"][0]["id"]

def namespace_create(self, name: str) -> dict:
url = "/api/ipam/namespaces/"
payload = {"name": name}
return self.make_api_request(url, "post", payload)

def namespace_delete(self, namespace_uuid: str) -> dict:
url = f"/api/ipam/namespaces/{namespace_uuid}/"
return self.make_api_request(url, "delete")

def prep_switch_interface(
self, connected_interface_id: str, ucvni_uuid: str
) -> str:
Expand Down

0 comments on commit d23a242

Please sign in to comment.