diff --git a/artifacts/infragraph.proto b/artifacts/infragraph.proto index f646fc2..5006fc6 100644 --- a/artifacts/infragraph.proto +++ b/artifacts/infragraph.proto @@ -630,108 +630,100 @@ message Annotation { repeated AnnotationAttribute graph = 4; } -// Represents a generic name and value pair attribute. -message NameValue { +// Attribute and its value. +message QueryAttribute { - // Name of the attribute or property. - optional string name = 1; + // The attribute key. + optional string attribute = 1; - // Value corresponding to the name. + // The attribute value. optional string value = 2; } -// Represents a single item returned from a query, identified by an id and associated -// attributes. -message QueryResponseItem { +// Matched node name and its attributes present in the graph. +message QueryResponseNode { - // Unique identifier of the item. - optional string id = 1; + // Matched node name present in the graph. + optional string name = 1; - // List of name-value pairs describing item attributes. - repeated NameValue attributes = 2; + // An inventory of attributes and values of the current node. + repeated QueryAttribute attributes = 2; } -// Represents a shortest path result containing a name and an ordered list of nodes -// on the path. -message QueryShortestPathItem { +// Matched edges and their attributes present in the graph. +message QueryResponseEdge { - // Name of the shortest path filter - // required = true - optional string name = 1; + // Matched endpoint one. + optional string ep1 = 1; + + // Matched endpoint two. + optional string ep2 = 2; - // An array of node ids that make up the shortest path - repeated string nodes = 2; + // An inventory of attributes and values. + repeated QueryAttribute attributes = 3; } -// The content of a query response, indicating the type of match and containing corresponding -// results. -message QueryResponseContent { +// Query response object - a query filter can act on the graph and respond with array +// of nodes or edges or graph attributes. +message QueryResponse { - message Choice { - enum Enum { - unspecified = 0; - node_matches = 1; - shortest_path_matches = 2; - } - } - // Indicates the type of results returned - node matches, shortest path matches, or - // graph attribute matches. - optional Choice.Enum choice = 1; + // List of matched nodes of the graph with attributes. + repeated QueryResponseNode nodes = 1; - // Array of nodes matching the query criteria. - repeated QueryResponseItem node_matches = 2; + // List of matched edges of the graph with attributes. + repeated QueryResponseEdge edges = 2; - // Array of shortest path results matching the query criteria. - repeated QueryShortestPathItem shortest_path_matches = 3; + // List of matched graph attributes. + repeated QueryAttribute graph = 3; } -// Criteria for filtering nodes based on attribute names, values, and operators. -message QueryAttribute { +// Defines request for node match +message QueryRequestNode { - // Attribute name to filter on. - optional string name = 1; + // Endpoint name that MUST exist or match edges present in the graph. This supports + // slicing operator and expands to the networkx expanded format: + // - server[0]xpu[0] + // - server[0:2] + // - switch + repeated string node_identifier = 1; - message Operator { - enum Enum { - unspecified = 0; - eq = 1; - regex = 2; - contains = 3; - } - } - // Operator used for attribute filtering. - optional Operator.Enum operator = 2; + // Attribute-based filter criteria. + QueryRequestAttribute attribute_filters = 2; +} - // Value to compare the attribute against. - optional string value = 3; +// Defines request for edge match +message QueryRequestEdge { - message Logic { - enum Enum { - unspecified = 0; - and = 1; - or = 2; - } - } - // Logical operation to combine this filter with others. - optional Logic.Enum logic = 4; + // Array of edge endpoints where you want to filter + repeated QueryRequestEdgeEndpoints endpoints = 1; + + // Attribute-based filter criteria. + QueryRequestAttribute attribute_filters = 2; } -// Criteria for filtering node IDs using specified operators and logical combinations. -message QueryNodeId { +// Defines request for edge match +message QueryRequestEdgeEndpoints { - message Operator { - enum Enum { - unspecified = 0; - eq = 1; - regex = 2; - contains = 3; - } - } - // Operator used to filter node IDs. - optional Operator.Enum operator = 1; + // Endpoint name that MUST exist or match edges present in the graph. This supports + // slicing operator and expands to the networkx expanded format: + // - server[0]xpu[0] + // - server[0:2] + // - switch + optional string ep1 = 1; - // Value pattern for filtering node IDs. - optional string value = 2; + // Endpoint name that MUST exist or match edges present in the graph. This supports + // slicing operator and expands to the networkx expanded format: + // - server[0]xpu[0] + // - server[0:2] + // - switch + optional string ep2 = 2; +} + +// Query request attributes with logical operation on all of the attributes. +message QueryRequestAttribute { + + // Attributes for filter + repeated QueryAttribute attributes = 1; message Logic { enum Enum { @@ -740,45 +732,35 @@ message QueryNodeId { or = 2; } } - // Logical operation to combine this ID filter with others. - optional Logic.Enum logic = 3; + // Logical operation to combine this filter with others. Default is and. + optional Logic.Enum logic = 2; } // Defines a filter on nodes, either by attributes or by node IDs. -message QueryNodeFilter { +message QueryRequestFilter { - // Name of this node filter. - optional string name = 1; + // Node name filter + QueryRequestNode node_filters = 1; - message Choice { - enum Enum { - unspecified = 0; - attribute_filter = 1; - id_filter = 2; - } - } - // Type of node filter, either attribute or ID based. - optional Choice.Enum choice = 2; - - // Attribute-based filter criteria. - QueryAttribute attribute_filter = 3; + // Edge filter. + QueryRequestEdge edge_filters = 2; - // ID-based filter criteria. - QueryNodeId id_filter = 4; + // Graph filter. + QueryRequestAttribute graph_filter = 3; } // Filter specifying the shortest path constraints, with source and destination nodes. -message QueryShortestPathFilter { +message QueryRequestShortestPath { // Name of the shortest path filter. // required = true optional string name = 1; - // Node ID from which to start the shortest path. + // Node ID from which to start the shortest path. This should be an EXACT match. // required = true optional string source = 2; - // Node ID at which the shortest path ends. + // Node ID at which the shortest path ends. This should be an EXACT match. // required = true optional string destination = 3; } @@ -790,21 +772,19 @@ message QueryRequest { message Choice { enum Enum { unspecified = 0; - node_filters = 1; - shortest_path_filters = 2; + filters = 1; + shortest_path = 2; } } // Type of filters specified in this query request. optional Choice.Enum choice = 1; - // List of filters to match nodes. - repeated QueryNodeFilter node_filters = 2; + // filter to get data from graph. + QueryRequestFilter filters = 2; - // Under Review: Proposal to abstract the shortest path interface to the graph. - // - // Add shortest path filters to retrive the shortest path between source and destination + // Add shortest path filters to retrieve the shortest path between source and destination // nodes - repeated QueryShortestPathFilter shortest_path_filters = 3; + QueryRequestShortestPath shortest_path = 3; } // Version details @@ -840,8 +820,8 @@ message GraphResponse { } // Answer to the query request. -message QueryResponse { - QueryResponseContent query_response_content = 1; +message QueryResponseContent { + QueryResponse query_response = 1; } // Data that needs to be streamed @@ -870,7 +850,7 @@ message QueryGraphRequest { QueryRequest query_request = 1; } message QueryGraphResponse { - QueryResponseContent query_response_content = 1; + QueryResponse query_response = 1; } diff --git a/artifacts/openapi.yaml b/artifacts/openapi.yaml index a049b4f..0f41435 100644 --- a/artifacts/openapi.yaml +++ b/artifacts/openapi.yaml @@ -93,10 +93,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/QueryRequest' + $ref: '#/components/schemas/Query.Request' responses: '200': - $ref: '#/components/responses/QueryResponse' + $ref: '#/components/responses/QueryResponseContent' x-field-uid: 1 default: $ref: '#/components/responses/Failure' @@ -164,13 +164,13 @@ components: application/json: schema: $ref: '#/components/schemas/GraphResponseContent' - QueryResponse: + QueryResponseContent: description: |- Answer to the query request. content: application/json: schema: - $ref: '#/components/schemas/QueryResponseContent' + $ref: '#/components/schemas/Query.Response' schemas: Infrastructure: description: |- @@ -990,165 +990,161 @@ components: items: $ref: '#/components/schemas/Annotation.Attribute' x-field-uid: 4 - NameValue: + Query.Attribute: description: |- - Represents a generic name and value pair attribute. + Attribute and its value. type: object properties: - name: + attribute: description: |- - Name of the attribute or property. + The attribute key. type: string x-field-uid: 1 value: description: |- - Value corresponding to the name. + The attribute value. type: string x-field-uid: 2 - QueryResponseItem: + Query.Response.Node: description: |- - Represents a single item returned from a query, identified by an id and associated attributes. + Matched node name and its attributes present in the graph. type: object properties: - id: + name: description: |- - Unique identifier of the item. + Matched node name present in the graph. type: string x-field-uid: 1 attributes: description: |- - List of name-value pairs describing item attributes. + An inventory of attributes and values of the current node. type: array items: - $ref: '#/components/schemas/NameValue' + $ref: '#/components/schemas/Query.Attribute' x-field-uid: 2 - QueryShortestPathItem: + Query.Response.Edge: description: |- - Represents a shortest path result containing a name and an ordered list of nodes on the path. + Matched edges and their attributes present in the graph. type: object - required: - - name - - nodes properties: - name: + ep1: description: |- - Name of the shortest path filter + Matched endpoint one. type: string x-field-uid: 1 - nodes: + ep2: description: |- - An array of node ids that make up the shortest path + Matched endpoint two. + type: string + x-field-uid: 2 + attributes: + description: |- + An inventory of attributes and values. type: array items: - type: string - x-field-uid: 2 - QueryResponseContent: + $ref: '#/components/schemas/Query.Attribute' + x-field-uid: 3 + Query.Response: description: |- - The content of a query response, indicating the type of match and containing corresponding results. + Query response object - a query filter can act on the graph and respond with array of nodes or edges or graph attributes. type: object properties: - choice: + nodes: description: |- - Indicates the type of results returned - node matches, shortest path matches, or graph attribute matches. - type: string - x-enum: - node_matches: - x-field-uid: 1 - shortest_path_matches: - x-field-uid: 2 + List of matched nodes of the graph with attributes. + type: array + items: + $ref: '#/components/schemas/Query.Response.Node' x-field-uid: 1 - enum: - - node_matches - - shortest_path_matches - node_matches: - description: |- - Array of nodes matching the query criteria. + edges: type: array + description: |- + List of matched edges of the graph with attributes. items: - $ref: '#/components/schemas/QueryResponseItem' + $ref: '#/components/schemas/Query.Response.Edge' x-field-uid: 2 - shortest_path_matches: + graph: description: |- - Array of shortest path results matching the query criteria. + List of matched graph attributes. type: array items: - $ref: '#/components/schemas/QueryShortestPathItem' + $ref: '#/components/schemas/Query.Attribute' x-field-uid: 3 - QueryAttribute: + Query.Request.Node: description: |- - Criteria for filtering nodes based on attribute names, values, and operators. + Defines request for node match type: object properties: - name: + node_identifier: description: |- - Attribute name to filter on. - type: string + Endpoint name that MUST exist or match edges present in the graph. This supports slicing operator and expands to the networkx expanded format: + - server[0]xpu[0] + - server[0:2] + - switch + type: array + items: + type: string x-field-uid: 1 - operator: + attribute_filters: description: |- - Operator used for attribute filtering. - type: string + Attribute-based filter criteria. + $ref: '#/components/schemas/Query.Request.Attribute' x-field-uid: 2 - x-enum: - eq: - x-field-uid: 1 - regex: - x-field-uid: 2 - contains: - x-field-uid: 3 - enum: - - eq - - regex - - contains - value: + Query.Request.Edge: + description: |- + Defines request for edge match + type: object + properties: + endpoints: description: |- - Value to compare the attribute against. - type: string - x-field-uid: 3 - logic: + Array of edge endpoints where you want to filter + type: array + items: + $ref: '#/components/schemas/Query.Request.Edge.Endpoints' + x-field-uid: 1 + attribute_filters: description: |- - Logical operation to combine this filter with others. - type: string - x-field-uid: 4 - x-enum: - and: - x-field-uid: 1 - or: - x-field-uid: 2 - enum: - - and - - or - QueryNodeId: + Attribute-based filter criteria. + $ref: '#/components/schemas/Query.Request.Attribute' + x-field-uid: 2 + Query.Request.Edge.Endpoints: description: |- - Criteria for filtering node IDs using specified operators and logical combinations. + Defines request for edge match type: object properties: - operator: + ep1: description: |- - Operator used to filter node IDs. + Endpoint name that MUST exist or match edges present in the graph. This supports slicing operator and expands to the networkx expanded format: + - server[0]xpu[0] + - server[0:2] + - switch type: string x-field-uid: 1 - x-enum: - eq: - x-field-uid: 1 - regex: - x-field-uid: 2 - contains: - x-field-uid: 3 - enum: - - eq - - regex - - contains - value: + ep2: description: |- - Value pattern for filtering node IDs. + Endpoint name that MUST exist or match edges present in the graph. This supports slicing operator and expands to the networkx expanded format: + - server[0]xpu[0] + - server[0:2] + - switch type: string x-field-uid: 2 + Query.Request.Attribute: + description: |- + Query request attributes with logical operation on all of the attributes. + type: object + properties: + attributes: + description: |- + Attributes for filter + type: array + items: + $ref: '#/components/schemas/Query.Attribute' + x-field-uid: 1 logic: description: |- - Logical operation to combine this ID filter with others. + Logical operation to combine this filter with others. Default is "and". type: string - x-field-uid: 3 + x-field-uid: 2 x-enum: and: x-field-uid: 1 @@ -1157,40 +1153,27 @@ components: enum: - and - or - QueryNodeFilter: + Query.Request.Filter: description: |- Defines a filter on nodes, either by attributes or by node IDs. type: object properties: - name: + node_filters: description: |- - Name of this node filter. - type: string + Node name filter + $ref: '#/components/schemas/Query.Request.Node' x-field-uid: 1 - choice: + edge_filters: description: |- - Type of node filter, either attribute or ID based. - type: string + Edge filter. + $ref: '#/components/schemas/Query.Request.Edge' x-field-uid: 2 - x-enum: - attribute_filter: - x-field-uid: 1 - id_filter: - x-field-uid: 2 - enum: - - attribute_filter - - id_filter - attribute_filter: + graph_filter: description: |- - Attribute-based filter criteria. - $ref: '#/components/schemas/QueryAttribute' + Graph filter. + $ref: '#/components/schemas/Query.Request.Attribute' x-field-uid: 3 - id_filter: - description: |- - ID-based filter criteria. - $ref: '#/components/schemas/QueryNodeId' - x-field-uid: 4 - QueryShortestPathFilter: + Query.Request.ShortestPath: description: |- Filter specifying the shortest path constraints, with source and destination nodes. type: object @@ -1206,15 +1189,15 @@ components: x-field-uid: 1 source: description: |- - Node ID from which to start the shortest path. + Node ID from which to start the shortest path. This should be an EXACT match. type: string x-field-uid: 2 destination: description: |- - Node ID at which the shortest path ends. + Node ID at which the shortest path ends. This should be an EXACT match. type: string x-field-uid: 3 - QueryRequest: + Query.Request: description: |- A request object specifying filters to be used for querying nodes, graph attributes, or shortest paths. type: object @@ -1225,32 +1208,23 @@ components: type: string x-field-uid: 1 x-enum: - node_filters: + filters: x-field-uid: 1 - shortest_path_filters: + shortest_path: x-field-uid: 2 enum: - - node_filters - - shortest_path_filters - node_filters: + - filters + - shortest_path + filters: description: |- - List of filters to match nodes. - type: array - items: - $ref: '#/components/schemas/QueryNodeFilter' + filter to get data from graph. + $ref: '#/components/schemas/Query.Request.Filter' x-field-uid: 2 - shortest_path_filters: + shortest_path: description: |- - Under Review: Proposal to abstract the shortest path interface to the graph. - - Add shortest path filters to retrive the shortest path between source and destination nodes - type: array - items: - $ref: '#/components/schemas/QueryShortestPathFilter' + Add shortest path filters to retrieve the shortest path between source and destination nodes + $ref: '#/components/schemas/Query.Request.ShortestPath' x-field-uid: 3 - x-status: - status: under_review - information: Proposal to abstract the shortest path interface to the graph. Version: description: |- Version details diff --git a/docs/src/openapi.html b/docs/src/openapi.html index ee8e12f..28234d3 100644 --- a/docs/src/openapi.html +++ b/docs/src/openapi.html @@ -594,17 +594,16 @@
XPU or NIC| choice | string Enum: "node_filters" "shortest_path_filters" Type of filters specified in this query request. - | ||||||
Array of objects (QueryNodeFilter) List of filters to match nodes. - | |||||||
Array of objects (QueryShortestPathFilter) Under Review: Proposal to abstract the shortest path interface to the graph. -Add shortest path filters to retrive the shortest path between source and destination nodes +Request Body schema: application/json
ResponsesRequest samples
Content type application/json {Response samples
Content type application/json {Request samples
Content type application/json {Response samples
Content type application/json { |