From 23e856dfeb6375591d7cd9807815e450b92806a9 Mon Sep 17 00:00:00 2001 From: Kelly Deng Date: Wed, 24 Jun 2020 13:26:00 -0400 Subject: [PATCH 1/2] updated json example to new structure --- docs/hello-world.md | 61 ++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/docs/hello-world.md b/docs/hello-world.md index ce6c48614..b49ae4967 100644 --- a/docs/hello-world.md +++ b/docs/hello-world.md @@ -13,48 +13,59 @@ While the data model changes are in progress, the following data should be enoug ```json { - "allow_pxe": true, - "allow_workflow": true, - "arch": "x86_64", - "facility_code": "onprem", - "id": "ce2e62ed-826f-4485-a39f-a82bb74338e2", - "ip_addresses": [ - { + "id": "0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94", + "metadata": { + "facility": { + "facility_code": "ewr1", + "plan_slug": "c2.medium.x86", + "plan_version_slug": "" + }, + "instance": {}, + "state": "" + }, + "network": { + "interfaces": [ + { + "dhcp": { + "arch": "x86_64", + "ip": { "address": "192.168.1.5", - "address_family": 4, - "enabled": true, "gateway": "192.168.1.1", - "management": true, - "netmask": "255.255.255.248", - "public": false - } - ], - "network_ports": [ - { - "data": { - "mac": "ec:0d:9a:bf:ff:dc" - }, - "name": "eth0", - "type": "data" + "netmask": "255.255.255.248" + }, + "mac": "00:00:00:00:00:00", + "uefi": false + }, + "netboot": { + "allow_pxe": true, + "allow_workflow": true } + } ] + } } ``` A few details to note: - `id` is the hardware UUID -- `allow_workflow` must be `true` to boot into workflow mode -- `ip_addresses.address` is the IP to hand out -- `network_ports` is the worker MAC address +- `network.interfaces[].netboot.allow_workflow` must be `true` to boot into workflow mode +- `network.interfaces[].dhcp.ip.address` is the IP to hand out +- `network.interfaces[].dhcp.mac` is the worker MAC address Now that we have the hardware data, we need to push it into the database. In order to do so, remove the extra spaces in the above JSON and use the following command to push the data: -``` +```shell $ tink hardware push '' ``` +Or, if you have your json data in a file (e.g. `data.json`), you can use the following: + +```shell +$ tink hardware push --file data.json +``` + Verify that the data was actually pushed using the command: ```shell From 6fcbe7e673b5bff8cb2be06f8c7c81a9823434b8 Mon Sep 17 00:00:00 2001 From: Kelly Deng Date: Wed, 24 Jun 2020 15:48:53 -0400 Subject: [PATCH 2/2] updated hello-world.md to reflect changes to hardware push command --- docs/hello-world.md | 68 +++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/docs/hello-world.md b/docs/hello-world.md index b49ae4967..5119fc525 100644 --- a/docs/hello-world.md +++ b/docs/hello-world.md @@ -13,36 +13,36 @@ While the data model changes are in progress, the following data should be enoug ```json { - "id": "0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94", - "metadata": { - "facility": { - "facility_code": "ewr1", - "plan_slug": "c2.medium.x86", - "plan_version_slug": "" - }, - "instance": {}, - "state": "" - }, - "network": { - "interfaces": [ - { - "dhcp": { - "arch": "x86_64", - "ip": { - "address": "192.168.1.5", - "gateway": "192.168.1.1", - "netmask": "255.255.255.248" - }, - "mac": "00:00:00:00:00:00", - "uefi": false + "id": "0eba0bf8-3772-4b4a-ab9f-6ebe93b90a94", + "metadata": { + "facility": { + "facility_code": "ewr1", + "plan_slug": "c2.medium.x86", + "plan_version_slug": "" }, - "netboot": { - "allow_pxe": true, - "allow_workflow": true - } - } - ] - } + "instance": {}, + "state": "" + }, + "network": { + "interfaces": [ + { + "dhcp": { + "arch": "x86_64", + "ip": { + "address": "192.168.1.5", + "gateway": "192.168.1.1", + "netmask": "255.255.255.248" + }, + "mac": "00:00:00:00:00:00", + "uefi": false + }, + "netboot": { + "allow_pxe": true, + "allow_workflow": true + } + } + ] + } } ``` @@ -54,16 +54,11 @@ A few details to note: - `network.interfaces[].dhcp.mac` is the worker MAC address Now that we have the hardware data, we need to push it into the database. -In order to do so, remove the extra spaces in the above JSON and use the following command to push the data: - -```shell -$ tink hardware push '' -``` - -Or, if you have your json data in a file (e.g. `data.json`), you can use the following: +In order to do so, save the above JSON into a file (e.g., `data.json`) and use either of the following commands to push the data: ```shell $ tink hardware push --file data.json +$ cat data.json | tink hardware push ``` Verify that the data was actually pushed using the command: @@ -97,6 +92,7 @@ We can now define a workflow with the following steps: - Create a workflow: ```shell + # the value of device_1 could be either the MAC address or IP address of the hardware/device $ tink workflow create -t -r '{"device_1":"mac/IP"}' ```