Skip to content

Commit bf86272

Browse files
feat(graph): add azure stack nodes and edges (#23)
1 parent cdc8795 commit bf86272

8 files changed

Lines changed: 205 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# AzureStackEdgeMachineNic
2+
3+
Represents network interface cards attached to Azure Stack HCI edge machines (not an ARM resource itself).
4+
5+
**Labels:** `:AzureStackEdgeMachineNic`
6+
7+
**Properties:**
8+
9+
- `machineId` - Parent edge machine ID (composite key with `adapterName`)
10+
- `adapterName` - Network adapter name (composite key with `machineId`)
11+
- `dnsServers` - DNS server addresses
12+
- `ip4Address` - IPv4 address
13+
- `macAddress` - MAC address
14+
- `rdmaCapability` - RDMA capability of the adapter
15+
- `subnetMask` - Subnet mask
16+
17+
## Relationships
18+
19+
### Incoming
20+
21+
- **AzureStackEdgeMachine**`HAS_NIC`**AzureStackEdgeMachineNic** - Parent edge machine
22+
23+
## Examples
24+
25+
```cypher
26+
// Find edge machines and their NIC details
27+
MATCH (em:AzureStackEdgeMachine)-[:HAS_NIC]->(nic:AzureStackEdgeMachineNic)
28+
RETURN em.id, nic.adapterName, nic.ip4Address, nic.macAddress, nic.rdmaCapability
29+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# AzureStackEdgeMachine
2+
3+
Represents Azure Stack HCI edge machine resources.
4+
5+
**Labels:** `:ArmResource:AzureStackEdgeMachine`
6+
7+
**Properties:**
8+
9+
- `id` - Edge machine resource ID (primary key)
10+
- `arcMachineResourceGroupId` - Resource group ID of the associated Arc machine
11+
- `arcMachineResourceId` - Resource ID of the associated Arc machine
12+
- `cloudId` - Cloud identifier this edge machine is registered with
13+
- `connectivityStatus` - Connectivity status of the edge machine
14+
- `devicePoolResourceId` - Device pool resource ID
15+
- `edgeMachineKind` - Kind/type of edge machine
16+
- `lastUpdated` - Last update timestamp
17+
- `lastSyncTimestamp` - Last synchronization timestamp
18+
- `machineState` - Current machine state
19+
20+
## Relationships
21+
22+
### Outgoing
23+
24+
- **AzureStackEdgeMachine**`REGISTERED_BY`**GraphObject** - Identity that registered this edge machine
25+
- **AzureStackEdgeMachine**`HAS_NIC`**AzureStackEdgeMachineNic** - Network interfaces attached to this edge machine
26+
27+
## Examples
28+
29+
```cypher
30+
// Find all edge machines and their connectivity status
31+
MATCH (em:AzureStackEdgeMachine)
32+
RETURN em.id, em.edgeMachineKind, em.connectivityStatus, em.machineState
33+
```
34+
35+
```cypher
36+
// Find edge machines and their network interfaces
37+
MATCH (em:AzureStackEdgeMachine)-[:HAS_NIC]->(nic:AzureStackEdgeMachineNic)
38+
RETURN em.id, nic.adapterName, nic.ip4Address, nic.macAddress
39+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# AzureStackRegistration
2+
3+
Represents Azure Stack registration resources, which link on-premises Azure Stack hardware to an Azure subscription.
4+
5+
**Labels:** `:ArmResource:AzureStackRegistration`
6+
7+
**Properties:**
8+
9+
- `id` - Registration resource ID (primary key)
10+
- `cloudId` - Cloud identifier for the registered Azure Stack
11+
12+
## Relationships
13+
14+
### Outgoing
15+
16+
- **AzureStackRegistration**`REGISTERED_BY`**GraphObject** - Identity that registered this Azure Stack
17+
18+
## Examples
19+
20+
```cypher
21+
// Find all Azure Stack registrations
22+
MATCH (r:AzureStackRegistration)
23+
RETURN r.id, r.cloudId
24+
```
25+
26+
```cypher
27+
// Find registrations and who registered them
28+
MATCH (r:AzureStackRegistration)-[:REGISTERED_BY]->(obj:GraphObject)
29+
RETURN r.id, r.cloudId, obj.id
30+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# REGISTERED_BY
2+
3+
Represents the relationship between an Azure Stack resource and the identity that registered it.
4+
5+
**Direction:** `(resource)-[:REGISTERED_BY]->(graphObject)`
6+
7+
**Description:** Indicates that an Azure Stack resource (registration or edge machine) was registered by a specific identity (Graph object).
8+
9+
**Properties:** None
10+
11+
## Usage
12+
13+
- **AzureStackRegistration**`REGISTERED_BY`**GraphObject** - Azure Stack registration associated with its registering identity
14+
- **AzureStackEdgeMachine**`REGISTERED_BY`**GraphObject** - Edge machine associated with its registering identity
15+
16+
## Query Examples
17+
18+
```cypher
19+
// Find all Azure Stack resources and their registering identities
20+
MATCH (r:ArmResource)-[:REGISTERED_BY]->(obj:GraphObject)
21+
WHERE r:AzureStackRegistration OR r:AzureStackEdgeMachine
22+
RETURN r.id, labels(r), obj.id
23+
```
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Azure Stack HCI Edge Machine"
2+
label: "{{ LABELS.AzureStackEdgeMachine }}"
3+
table_name: "resources"
4+
resource_type: "microsoft.azurestackhci/edgemachines"
5+
properties:
6+
- "/id"
7+
- "/properties"
8+
index_properties:
9+
- "{{ LABELS.AzureStackEdgeMachine }}:cloudId"
10+
- "{{ LABELS.AzureStackEdgeMachineNic }}:machineId+adapterName"
11+
cypher: |
12+
UNWIND $batch AS row
13+
MERGE (obj:{{ LABELS.ArmResource }} {id: toLower(row.id)})
14+
SET obj:{{ LABELS.AzureStackEdgeMachine }}
15+
SET obj += {
16+
17+
// Not sure how to link these to other resources, so just storing the IDs for now
18+
arcMachineResourceGroupId: row.properties.arcMachineResourceGroupId,
19+
arcMachineResourceId: row.properties.arcMachineResourceId,
20+
21+
// The Cloud ID is a reference to the cloud this edge machine is registered with
22+
// It looks like it's a HybridMachine name but unsure of how to link it so just storing the ID for now
23+
cloudId: row.properties.cloudId,
24+
25+
26+
connectivityStatus: row.properties.connectivityStatus,
27+
devicePoolResourceId: row.properties.devicePoolResourceId,
28+
edgeMachineKind: row.properties.edgeMachineKind,
29+
lastUpdated: row.properties.lastUpdated,
30+
lastSyncTimestamp: row.properties.lastSyncTimestamp,
31+
machineState: row.properties.machineState
32+
}
33+
34+
CALL (obj, row) {
35+
WITH obj, row
36+
WHERE row.properties.objectId IS NOT NULL
37+
MERGE (s:{{ LABELS.GraphObject }} {id: toLower(row.properties.objectId)})
38+
MERGE (obj)-[:{{ REL.REGISTERED_BY }}]->(s)
39+
}
40+
41+
CALL (obj, row) {
42+
UNWIND coalesce(row.properties.networkProfile.nicDetails, []) AS nic
43+
MERGE (n:{{ LABELS.AzureStackEdgeMachineNic }} {machineId: toLower(row.id), adapterName: nic.adapterName})
44+
SET n += {
45+
adapterName: nic.adapterName,
46+
dnsServers: nic.dnsServers,
47+
ip4Address: nic.ip4Address,
48+
macAddress: nic.macAddress,
49+
rdmaCapability: nic.rdmaCapability,
50+
subnetMask: nic.subnetMask
51+
}
52+
MERGE (obj)-[:{{ REL.HAS_NIC }}]->(n)
53+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Azure Stack Registration"
2+
label: "{{ LABELS.AzureStackRegistration }}"
3+
table_name: "resources"
4+
resource_type: "microsoft.azurestack/registrations"
5+
properties:
6+
- "/id"
7+
- "/properties"
8+
cypher: |
9+
UNWIND $batch AS row
10+
MERGE (obj:{{ LABELS.ArmResource }} {id: toLower(row.id)})
11+
SET obj:{{ LABELS.AzureStackRegistration }}
12+
SET obj += {
13+
cloudId: row.properties.cloudId
14+
}
15+
16+
CALL (obj, row) {
17+
WITH obj, row
18+
WHERE row.properties.objectId IS NOT NULL
19+
MERGE (s:{{ LABELS.GraphObject }} {id: toLower(row.properties.objectId)})
20+
MERGE (obj)-[:{{ REL.REGISTERED_BY }}]->(s)
21+
}

src/graph/config/constants.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ REL:
7272
OWNS: "OWNS"
7373
PEERS_WITH: "PEERS_WITH"
7474
REFERENCES_PACKAGE: "REFERENCES_PACKAGE"
75+
REGISTERED_BY: "REGISTERED_BY"
7576
REGISTERED_OWNER: "REGISTERED_OWNER"
7677
REGISTERED_USER: "REGISTERED_USER"
7778
REPRESENTED_BY: "REPRESENTED_BY"
@@ -98,6 +99,8 @@ LABELS:
9899
AvailabilitySet: "AvailabilitySet"
99100
ArcSqlServer: "ArcSqlServer"
100101
ArcSqlDB: "ArcSqlDB"
102+
AzureStackEdgeMachine: "AzureStackEdgeMachine"
103+
AzureStackRegistration: "AzureStackRegistration"
101104
BastionHost: "BastionHost"
102105
B2CDirectory: "B2CDirectory"
103106
CAPNamedLocation: "CAPNamedLocation"
@@ -201,6 +204,7 @@ LABELS:
201204

202205
# Specialized Azure node types. These are not ARM resources or Graph objects but are created from properties of those.
203206
AnalysisServiceFirewallRule: "AnalysisServiceFirewallRule"
207+
AzureStackEdgeMachineNic: "AzureStackEdgeMachineNic"
204208
BastionIPConfig: "BastionIPConfig"
205209
Certificate: "Certificate"
206210
ClientSecret: "ClientSecret"

zensical.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ nav = [
9898
"analysis/arm-nodes/azure-core/resource-group.md",
9999
"analysis/arm-nodes/azure-core/management-group.md",
100100
] },
101+
{ "Azure Stack" = [
102+
"analysis/arm-nodes/azurestack/azure-stack-edge-machine.md",
103+
"analysis/arm-nodes/azurestack/azure-stack-registration.md",
104+
] },
101105
{ "CDN" = [
102106
"analysis/arm-nodes/cdn/cdn-profile.md",
103107
"analysis/arm-nodes/cdn/afd-endpoint.md",
@@ -252,6 +256,7 @@ nav = [
252256
{ "Additional Nodes" = [
253257
"analysis/additional-nodes.md",
254258
"analysis/additional-nodes/analysis-service-firewall-rule.md",
259+
"analysis/additional-nodes/azure-stack-edge-machine-nic.md",
255260
"analysis/additional-nodes/bastion-ip-config.md",
256261
"analysis/additional-nodes/certificate.md",
257262
"analysis/additional-nodes/client-secret.md",
@@ -357,6 +362,7 @@ nav = [
357362
"analysis/edges/deploys.md",
358363
"analysis/edges/peers-with.md",
359364
"analysis/edges/references-package.md",
365+
"analysis/edges/registered-by.md",
360366
"analysis/edges/registered-owner.md",
361367
"analysis/edges/registered-user.md",
362368
"analysis/edges/represented-by.md",

0 commit comments

Comments
 (0)