From 7ca54cf54d10ebbc55b252df2fd4d909f591934b Mon Sep 17 00:00:00 2001
From: Ryan Li <54458876+ryli17@users.noreply.github.com>
Date: Mon, 18 Nov 2024 10:02:57 -0800
Subject: [PATCH] change data path and readme (#3)
---
.gitignore | 3 +
README.md | 81 +++++++++++++++++--
jsonschema/catalog.json | 16 ++--
.../{events => }/fabric/v1/ChangeAlert.json | 4 +-
.../{events => }/fabric/v1/ChangeEvent.json | 4 +-
.../{events => }/fabric/v1/MetricAlert.json | 4 +-
.../{events => }/fabric/v1/MetricEvent.json | 4 +-
scripts/generate_json_catalog.py | 2 +-
scripts/generate_readme_event_catalog.py | 21 ++---
9 files changed, 104 insertions(+), 35 deletions(-)
rename jsonschema/equinix/{events => }/fabric/v1/ChangeAlert.json (98%)
rename jsonschema/equinix/{events => }/fabric/v1/ChangeEvent.json (98%)
rename jsonschema/equinix/{events => }/fabric/v1/MetricAlert.json (98%)
rename jsonschema/equinix/{events => }/fabric/v1/MetricEvent.json (98%)
diff --git a/.gitignore b/.gitignore
index 44b38f7..c111e88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,8 @@
# OS X Finder Files
.DS_Store
+# IDE files
+.idea
+
# Local Setup Scripts for Repo
local_helper_scripts/*
diff --git a/README.md b/README.md
index ed72b9f..a47b32b 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,84 @@
-# cloud-events
+# Equinix CloudEvents
Equinix published [CloudEvent](https://cloudevents.io/) Types
-Definitive "source of truth" for the Equinix Observability event data formats
+Definitive "source of truth" for the Equinix Interconnection Observability event data formats
## CloudEvents in this repository
-The following data payloads are the supported events and formats for Equinix Observability
+The following data payloads are the supported events and formats for Equinix Interconnection Observability
+### Equinix Fabric ChangeAlert
+#### DataSchema [JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/ChangeAlert.json)
+#### Data Type
+`equinix.events.fabric.v1.ChangeAlert`
+#### CloudEvent Type(s)
-|Product|Schemas|Types|
-|Equinix Fabric ChangeAlert|[JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/ChangeAlert.json)|
Data Type:
`equinix.events.fabric.v1.ChangeAlert`
CloudEvent Type(s):
|
-|Equinix Fabric ChangeEvent|[JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/ChangeEvent.json)|
Data Type:
`equinix.events.fabric.v1.ChangeEvent`
CloudEvent Type(s):
`equinix.fabric.router.state.provisioning`
`equinix.fabric.router.state.provisioned`
`equinix.fabric.router.state.reprovisioning`
`equinix.fabric.router.state.deprovisioning`
`equinix.fabric.router.state.deprovisioned`
`equinix.fabric.router.state.failed`
`equinix.fabric.router.state.not_provisioned`
`equinix.fabric.router.state.not_deprovisioned`
`equinix.fabric.port.state.provisioned`
`equinix.fabric.port.state.deprovisioned`
`equinix.fabric.port.state.failed`
`equinix.fabric.port.status.up`
`equinix.fabric.port.status.down`
`equinix.fabric.service_token.state.inactive`
`equinix.fabric.service_token.state.deleted`
`equinix.fabric.service_token.attribute.changed`
`equinix.fabric.connection.state.pending`
`equinix.fabric.connection.state.pending_interface_configuration`
`equinix.fabric.connection.state.provisioning`
`equinix.fabric.connection.state.provisioned`
`equinix.fabric.connection.state.deprovisioning`
`equinix.fabric.connection.state.deprovisioned`
`equinix.fabric.connection.state.pending_approval`
`equinix.fabric.connection.attribute.changed`
`equinix.fabric.connection.status.up`
`equinix.fabric.connection.status.down`
`equinix.fabric.connection.bgpipv4_session_status.established`
`equinix.fabric.connection.bgpipv4_session_status.idle`
`equinix.fabric.connection.bgpipv4_session_status.connect`
`equinix.fabric.connection.bgpipv6_session_status.established`
`equinix.fabric.connection.bgpipv6_session_status.idle`
`equinix.fabric.connection.bgpipv6_session_status.connect`
`equinix.fabric.network.state.provisioning`
`equinix.fabric.network.state.provisioned`
`equinix.fabric.network.state.deprovisioning`
`equinix.fabric.network.state.deprovisioned`
|
-|Equinix Fabric MetricAlert|[JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/MetricAlert.json)|
Data Type:
`equinix.events.fabric.v1.MetricAlert`
CloudEvent Type(s):
|
-|Equinix Fabric MetricEvent|[JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/MetricEvent.json)|
Data Type:
`equinix.events.fabric.v1.MetricEvent`
CloudEvent Type(s):
`equinix.fabric.metric`
Metric Type(s):
`equinix.fabric.port.packets_erred_rx.count`
`equinix.fabric.port.packets_erred_tx.count`
`equinix.fabric.port.packets_dropped_rx.count`
`equinix.fabric.port.packets_dropped_tx.count`
`equinix.fabric.metro.{:asideMetroCode}_{:zsideMetroCode}.latency`
`equinix.fabric.connection.bandwidth_rx.usage`
`equinix.fabric.connection.bandwidth_tx.usage`
`equinix.fabric.port.bandwidth_rx.usage`
`equinix.fabric.port.bandwidth_tx.usage`|
+### Equinix Fabric ChangeEvent
+#### DataSchema [JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/ChangeEvent.json)
+#### Data Type
+`equinix.events.fabric.v1.ChangeEvent`
+#### CloudEvent Type(s)
+`equinix.fabric.router.state.provisioning`
+`equinix.fabric.router.state.provisioned`
+`equinix.fabric.router.state.reprovisioning`
+`equinix.fabric.router.state.deprovisioning`
+`equinix.fabric.router.state.deprovisioned`
+`equinix.fabric.router.state.failed`
+`equinix.fabric.router.state.not_provisioned`
+`equinix.fabric.router.state.not_deprovisioned`
+`equinix.fabric.port.state.provisioned`
+`equinix.fabric.port.state.deprovisioned`
+`equinix.fabric.port.state.failed`
+`equinix.fabric.port.status.up`
+`equinix.fabric.port.status.down`
+`equinix.fabric.service_token.state.inactive`
+`equinix.fabric.service_token.state.deleted`
+`equinix.fabric.service_token.attribute.changed`
+`equinix.fabric.connection.state.pending`
+`equinix.fabric.connection.state.pending_interface_configuration`
+`equinix.fabric.connection.state.provisioning`
+`equinix.fabric.connection.state.provisioned`
+`equinix.fabric.connection.state.deprovisioning`
+`equinix.fabric.connection.state.deprovisioned`
+`equinix.fabric.connection.state.pending_approval`
+`equinix.fabric.connection.attribute.changed`
+`equinix.fabric.connection.status.up`
+`equinix.fabric.connection.status.down`
+`equinix.fabric.connection.bgpipv4_session_status.established`
+`equinix.fabric.connection.bgpipv4_session_status.idle`
+`equinix.fabric.connection.bgpipv4_session_status.connect`
+`equinix.fabric.connection.bgpipv6_session_status.established`
+`equinix.fabric.connection.bgpipv6_session_status.idle`
+`equinix.fabric.connection.bgpipv6_session_status.connect`
+`equinix.fabric.network.state.provisioning`
+`equinix.fabric.network.state.provisioned`
+`equinix.fabric.network.state.deprovisioning`
+`equinix.fabric.network.state.deprovisioned`
+
+### Equinix Fabric MetricAlert
+#### DataSchema [JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/MetricAlert.json)
+#### Data Type
+`equinix.events.fabric.v1.MetricAlert`
+#### CloudEvent Type(s)
+
+
+### Equinix Fabric MetricEvent
+#### DataSchema [JSON](https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/MetricEvent.json)
+#### Data Type
+`equinix.events.fabric.v1.MetricEvent`
+#### CloudEvent Type(s)
+`equinix.fabric.metric`
+#### Metric Type(s)
+`equinix.fabric.port.packets_erred_rx.count`
+`equinix.fabric.port.packets_erred_tx.count`
+`equinix.fabric.port.packets_dropped_rx.count`
+`equinix.fabric.port.packets_dropped_tx.count`
+`equinix.fabric.metro.{:asideMetroCode}_{:zsideMetroCode}.latency`
+`equinix.fabric.connection.bandwidth_rx.usage`
+`equinix.fabric.connection.bandwidth_tx.usage`
+`equinix.fabric.port.bandwidth_rx.usage`
+`equinix.fabric.port.bandwidth_tx.usage`
diff --git a/jsonschema/catalog.json b/jsonschema/catalog.json
index f303b6a..1fe4624 100644
--- a/jsonschema/catalog.json
+++ b/jsonschema/catalog.json
@@ -3,16 +3,16 @@
"version": 1,
"schemas": [
{
- "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/ChangeAlert.json",
- "product": "Equinix Fabric ChangeAlert",
+ "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/ChangeAlert.json",
+ "domain": "Equinix Fabric ChangeAlert",
"name": "ChangeAlert",
"description": "The data within all ChangeAlert events.",
"datatype": "equinix.events.fabric.v1.ChangeAlert",
"cloudeventTypes": []
},
{
- "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/ChangeEvent.json",
- "product": "Equinix Fabric ChangeEvent",
+ "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/ChangeEvent.json",
+ "domain": "Equinix Fabric ChangeEvent",
"name": "ChangeEvent",
"description": "The data within all ChangeEvent events.",
"datatype": "equinix.events.fabric.v1.ChangeEvent",
@@ -56,16 +56,16 @@
]
},
{
- "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/MetricAlert.json",
- "product": "Equinix Fabric MetricAlert",
+ "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/MetricAlert.json",
+ "domain": "Equinix Fabric MetricAlert",
"name": "MetricAlert",
"description": "The data within all MetricAlert events.",
"datatype": "equinix.events.fabric.v1.MetricAlert",
"cloudeventTypes": []
},
{
- "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/MetricEvent.json",
- "product": "Equinix Fabric MetricEvent",
+ "url": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/MetricEvent.json",
+ "domain": "Equinix Fabric MetricEvent",
"name": "MetricEvent",
"description": "The data within all MetricEvent events.",
"datatype": "equinix.events.fabric.v1.MetricEvent",
diff --git a/jsonschema/equinix/events/fabric/v1/ChangeAlert.json b/jsonschema/equinix/fabric/v1/ChangeAlert.json
similarity index 98%
rename from jsonschema/equinix/events/fabric/v1/ChangeAlert.json
rename to jsonschema/equinix/fabric/v1/ChangeAlert.json
index 3175b44..0624e26 100644
--- a/jsonschema/equinix/events/fabric/v1/ChangeAlert.json
+++ b/jsonschema/equinix/fabric/v1/ChangeAlert.json
@@ -1,11 +1,11 @@
{
- "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/ChangeAlert.json",
+ "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/ChangeAlert.json",
"name": "ChangeAlert",
"examples": [],
"package": "equinix.events.fabric.v1",
"datatype": "equinix.events.fabric.v1.ChangeAlert",
"cloudeventTypes": [],
- "product": "Equinix Fabric ChangeAlert",
+ "domain": "Equinix Fabric ChangeAlert",
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Data",
"definitions": {
diff --git a/jsonschema/equinix/events/fabric/v1/ChangeEvent.json b/jsonschema/equinix/fabric/v1/ChangeEvent.json
similarity index 98%
rename from jsonschema/equinix/events/fabric/v1/ChangeEvent.json
rename to jsonschema/equinix/fabric/v1/ChangeEvent.json
index ecc3f7f..9bb7102 100644
--- a/jsonschema/equinix/events/fabric/v1/ChangeEvent.json
+++ b/jsonschema/equinix/fabric/v1/ChangeEvent.json
@@ -1,5 +1,5 @@
{
- "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/ChangeEvent.json",
+ "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/ChangeEvent.json",
"name": "ChangeEvent",
"examples": [],
"package": "equinix.events.fabric.v1",
@@ -42,7 +42,7 @@
"equinix.fabric.network.state.deprovisioning",
"equinix.fabric.network.state.deprovisioned"
],
- "product": "Equinix Fabric ChangeEvent",
+ "domain": "Equinix Fabric ChangeEvent",
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Data",
"definitions": {
diff --git a/jsonschema/equinix/events/fabric/v1/MetricAlert.json b/jsonschema/equinix/fabric/v1/MetricAlert.json
similarity index 98%
rename from jsonschema/equinix/events/fabric/v1/MetricAlert.json
rename to jsonschema/equinix/fabric/v1/MetricAlert.json
index 41c55ae..6d213c3 100644
--- a/jsonschema/equinix/events/fabric/v1/MetricAlert.json
+++ b/jsonschema/equinix/fabric/v1/MetricAlert.json
@@ -1,11 +1,11 @@
{
- "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/MetricAlert.json",
+ "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/MetricAlert.json",
"name": "MetricAlert",
"examples": [],
"package": "equinix.events.fabric.v1",
"datatype": "equinix.events.fabric.v1.MetricAlert",
"cloudeventTypes": [],
- "product": "Equinix Fabric MetricAlert",
+ "domain": "Equinix Fabric MetricAlert",
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Data",
"definitions": {
diff --git a/jsonschema/equinix/events/fabric/v1/MetricEvent.json b/jsonschema/equinix/fabric/v1/MetricEvent.json
similarity index 98%
rename from jsonschema/equinix/events/fabric/v1/MetricEvent.json
rename to jsonschema/equinix/fabric/v1/MetricEvent.json
index 9c7f13c..73e6352 100644
--- a/jsonschema/equinix/events/fabric/v1/MetricEvent.json
+++ b/jsonschema/equinix/fabric/v1/MetricEvent.json
@@ -1,5 +1,5 @@
{
- "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/events/fabric/v1/MetricEvent.json",
+ "$id": "https://equinix.github.io/equinix-cloudevents/jsonschema/equinix/fabric/v1/MetricEvent.json",
"name": "MetricEvent",
"examples": [],
"package": "equinix.events.fabric.v1",
@@ -7,7 +7,7 @@
"cloudeventTypes": [
"equinix.fabric.metric"
],
- "product": "Equinix Fabric MetricEvent",
+ "domain": "Equinix Fabric MetricEvent",
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/Data",
"metricNames": [
diff --git a/scripts/generate_json_catalog.py b/scripts/generate_json_catalog.py
index 114f148..f99cd2b 100644
--- a/scripts/generate_json_catalog.py
+++ b/scripts/generate_json_catalog.py
@@ -11,7 +11,7 @@ def retrieve_json_schemas():
data = json.load(eventFile)
newItem = {
"url": data["$id"],
- "product": data["product"],
+ "domain": data["domain"],
"name": data["name"],
"description": data["definitions"]["Data"]["description"],
"datatype": data["datatype"],
diff --git a/scripts/generate_readme_event_catalog.py b/scripts/generate_readme_event_catalog.py
index 6cd05b9..9c88bb9 100644
--- a/scripts/generate_readme_event_catalog.py
+++ b/scripts/generate_readme_event_catalog.py
@@ -2,12 +2,18 @@
import json
def table_row(schema):
- cloudEventTypes = "
".join(map(lambda x: f"`{x}`", schema["cloudeventTypes"]))
+ cloudEventTypes = "
\n".join(map(lambda x: f"`{x}`", schema["cloudeventTypes"]))
metrics = ""
if "metricNames" in schema:
- metricNames = "
".join(map(lambda x: f"`{x}`", schema["metricNames"]))
- metrics = f"
Metric Type(s):
{metricNames}"
- return f"|{schema["product"]}|[JSON]({schema["url"]})|
Data Type:
`{schema["datatype"]}`
CloudEvent Type(s):
{cloudEventTypes}
{metrics}|"
+ metricNames = "
\n".join(map(lambda x: f"`{x}`", schema["metricNames"]))
+ metrics = f"#### Metric Type(s)\n{metricNames}"
+ return f"""### {schema["domain"]}
+#### DataSchema [JSON]({schema["url"]})
+#### Data Type
+`{schema["datatype"]}`
+#### CloudEvent Type(s)
+{cloudEventTypes}
+{metrics}"""
def replace_readme_catalog():
readme_path = os.path.dirname(os.path.abspath(__file__)) + "/../README.md"
@@ -16,11 +22,6 @@ def replace_readme_catalog():
catalog = json.load(catalog_file)
schemas = "\n".join(map(table_row, catalog["schemas"]))
- replacement_readme_catalog = f"""
-|Product|Schemas|Types|
-{schemas}
-"""
-
with open(readme_path, "r+") as readme_file:
content = readme_file.read()
readme_file.seek(0)
@@ -29,7 +30,7 @@ def replace_readme_catalog():
header = content[:content.index(generation_start)+len(generation_start)]
footer = content[content.index(generation_end):]
readme_file.write(f"""{header}
-{replacement_readme_catalog}
+{schemas}
{footer}""")
readme_file.truncate()