Skip to content

Commit

Permalink
Merge branch 'stable' into bdl-20241030-stable-merge-conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lykinsbd committed Oct 31, 2024
2 parents 3539bf1 + f9b4139 commit 45113dc
Show file tree
Hide file tree
Showing 12 changed files with 398 additions and 34 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang
- Fixes an issue where docker compose would output ANSI control characters that don't support it
- Prevent temporary directories generated by Docusaurus to be imported by Docker

## [0.16.4](https://github.com/opsmill/infrahub/tree/v0.16.4) - 2024-10-17

### Fixed

- Fixed an issue on the UI where a new relationship was being added to the main branch instead of the current branch. ([#4598](https://github.com/opsmill/infrahub/issues/4598))

## [0.16.3](https://github.com/opsmill/infrahub/tree/v0.16.3) - 2024-10-10

### Removed
Expand Down
25 changes: 24 additions & 1 deletion docs/docs/guides/create-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ Load the schema into Infrahub in the `network-device-schema` branch
infrahubctl schema load --branch network-device-schema /tmp/schema_guide.yml
```

We can inspect the schema in the [Web UI](http://localhost:8000/schema?branch=network-device-schema) (Unified Storage > Schema)
We can inspect the schema in the [Web UI](http://localhost:8000/schema?branch=network-device-schema) (Unified Storage > Schema) as shown below.

![schema page screenshot](../media/guides/create_schema_1.png)

We'll create a device and an interface according to the schema, by executing the following GraphQL query

Expand All @@ -109,6 +111,25 @@ mutation {
}
```

Here is an example of using `curl` to make the query. Make sure to replace the `X-INFRAHUB-KEY` and the IP address with your actual details. Please also make sure to include the name of the branch in the URL. If you want to learn more about GraphQL, you can find more information [here](https://docs.infrahub.app/topics/graphql).

```graphql
curl -X POST http://localhost:8000/graphql/network-device-schema \
-H "Content-Type: application/json" \
-H "X-INFRAHUB-KEY: 1802eed5-eeb7-cc45-2e4d-c51de9d66cba" \
-d '{"query": "mutation { NetworkDeviceCreate(data: {hostname: {value: \"atl1-edge1\"}, model: {value: \"Cisco ASR1002-HX\"}}) { ok object { id } } NetworkInterfaceCreate(data: {name: {value: \"Ethernet1\"}, description: {value: \"WAN interface\"}}) { ok object { id } } }"}'
```

You can verify this in the GUI by navigating to 'Objects' and selecting 'Device' or 'Interface'.

![schema page screenshot](../media/guides/create_schema_2.png)

Finally, you can merge the `network-device-schema` branch to 'main' by running the following command.

```shell
infrahubctl branch merge network-device-schema
```

We have now successfully created our first schema, loaded into a branch into Infrahub, created the first nodes and merged the changes into the main branch of Infrahub.

## 2. Adding relationships to the nodes
Expand Down Expand Up @@ -191,6 +212,8 @@ mutation {

In the Web UI we can now see that the device has a relation to the Ethernet1 interface.

![schema page screenshot](../media/guides/create_schema_3.png)

## 3. Abstracting nodes into generics

We would like to add another interface `Vlan1` to our device `atl1-edge1`. We could add the interface as a `NetworkInterface` node, however this could cause some problems. The `Vlan1` interface is a logical interface, `Ethernet1` on the other hand is a physical interface. While physical interfaces a lot of properties in common with logical interfaces, they also have their differences. A cable can be plugged into a Physical interface, which you cannot do on a logical interface.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ cd ~/source/infrahub/
Next, clone the Infrahub GitHub repository into the current directory.

```shell
git clone --recursive -b stable --depth 1 https://github.com/opsmill/infrahub.git
git clone --recursive --depth 1 https://github.com/opsmill/infrahub.git
```

:::note
Expand Down
Loading

0 comments on commit 45113dc

Please sign in to comment.