summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2023-04-17 07:10:06 +0200
committerThomas Haller <thaller@redhat.com>2023-05-12 12:42:55 +0200
commitc72e085f5cb1c10a380aed0969c1503f374667c5 (patch)
treedc8cfb99c31ac38b5263a7f332000e04f1c01804
parent5b5ef08aee88a6f30e4ae16b41ce6c9bdc136459 (diff)
downloadNetworkManager-c72e085f5cb1c10a380aed0969c1503f374667c5.tar.gz
test/cloud-meta-mock: mock GCP metadata API
Not used for testing, but still might be useful for development.
-rwxr-xr-xtools/test-cloud-meta-mock.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/test-cloud-meta-mock.py b/tools/test-cloud-meta-mock.py
index 387b7544f6..ab3630addf 100755
--- a/tools/test-cloud-meta-mock.py
+++ b/tools/test-cloud-meta-mock.py
@@ -92,6 +92,9 @@ def default_resources():
azure_iface = azure_meta + b"/network/interface/"
azure_query = b"?format=text&api-version=2017-04-02"
+ gcp_meta = b"/computeMetadata/v1/instance/"
+ gcp_iface = gcp_meta + b"network-interfaces/"
+
mac1 = b"9e:c0:3e:92:24:2d"
mac2 = b"53:e9:7e:52:8d:a8"
@@ -129,6 +132,14 @@ def default_resources():
azure_iface + b"1/ipv4/subnet/0/address/" + azure_query: b"172.31.166.0",
azure_iface + b"0/ipv4/subnet/0/prefix/" + azure_query: b"20",
azure_iface + b"1/ipv4/subnet/0/prefix/" + azure_query: b"20",
+ gcp_meta + b"id": b"",
+ gcp_iface: b"0\n1\n",
+ gcp_iface + b"0/mac": mac1,
+ gcp_iface + b"1/mac": mac2,
+ gcp_iface + b"0/forwarded-ips/": b"0\n",
+ gcp_iface + b"0/forwarded-ips/0": ip1,
+ gcp_iface + b"1/forwarded-ips/": b"0\n",
+ gcp_iface + b"1/forwarded-ips/0": ip2,
}