Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR 330 add switch to layer #483

Merged
merged 25 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9402800
adjusted ordering of devices
plehocky Jul 10, 2024
81e447a
qRevert "adjusted ordering of devices"
plehocky Jul 10, 2024
d9e0b32
Merge branch 'main' of github.com:FRINXio/frinx-inventory-server
plehocky Jul 16, 2024
20882ad
Merge branch 'main' of github.com:FRINXio/frinx-inventory-server
plehocky Jul 16, 2024
9939fe0
Merge branch 'main' of github.com:FRINXio/frinx-inventory-server
plehocky Jul 19, 2024
8aca17e
FR-201 add edit device location (#454)
soson Jul 26, 2024
5499887
fixed locationId to be stored on creating device (#457)
plehocky Aug 6, 2024
e0b618c
FR-235 start stop time (#453) (#458)
soson Aug 7, 2024
6933347
Merge mpls (#459)
soson Aug 7, 2024
de1b511
updateLocation, deleteLocation mutations added (#460)
soson Aug 7, 2024
9e375c8
Merge branch 'main' of github.com:FRINXio/frinx-inventory-server
plehocky Aug 9, 2024
bce4941
mpls changes (#461)
soson Aug 12, 2024
8477694
Fr 327 show overlay topology (#462)
plehocky Aug 16, 2024
e5b14ea
mpls count queries added (#463)
soson Aug 19, 2024
6a1b0a6
FR-317 mpls topology version (#464)
soson Aug 21, 2024
f378487
FR-329 - topology overlay integration (#465)
plehocky Aug 21, 2024
e6956b9
added neighbor query for map topology devices (#466)
plehocky Aug 28, 2024
538f0a8
FR-312 lsp path (#467)
soson Sep 2, 2024
5b42b8d
FD-696 update apis (#468)
soson Sep 2, 2024
a4d2227
remove device from cache before reading status (#469)
soson Sep 9, 2024
b70558d
added query to get topology of specific device
plehocky Sep 26, 2024
5b25e20
Merge branch 'main' of github.com:FRINXio/frinx-inventory-server
plehocky Sep 26, 2024
4895910
resolved conflicts
plehocky Sep 26, 2024
e3c5b48
removed console.log
plehocky Sep 26, 2024
578317f
Merge branch 'main' into FR-330-add-switch-to-layer
plehocky Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/__generated__/topology-discovery.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/external-api/topology-discovery-graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
MplsPathQueryVariables,
NeighborsQuery,
NeighborsQueryVariables,
TopologiesQuery,
} from '../__generated__/topology-discovery.graphql';
import { TopologyDiffOutput, decodeTopologyDiffOutput } from './topology-network-types';

Expand Down Expand Up @@ -576,6 +577,15 @@ const MAP_NEIGHBORS = gql`
}
`;

const TOPOLOGIES = gql`
query Topologies($deviceName: String!) {
topologies(deviceName: $deviceName) {
topologyId
deviceId
}
}
`;

function getTopologyDiscoveryApi() {
if (!config.topologyEnabled) {
return undefined;
Expand Down Expand Up @@ -615,6 +625,13 @@ function getTopologyDiscoveryApi() {
return response;
}

async function getTopologyOfDevice(deviceName: string): Promise<TopologiesQuery> {
const response = await client.request<TopologiesQuery>(TOPOLOGIES, {
deviceName,
});
return response;
}

async function getTopologyDiff(version: string, collectionType: TopologyType): Promise<TopologyDiffOutput> {
const response = await client.request<TopologyDiffQuery, TopologyDiffQueryVariables>(GET_TOPOLOGY_DIFF, {
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down Expand Up @@ -759,6 +776,7 @@ function getTopologyDiscoveryApi() {
getMplsLspCount,
getLspPath,
getMapNeighbors,
getTopologyOfDevice,
};
}

Expand Down
10 changes: 10 additions & 0 deletions src/schema/api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ type Query {
last: Int
orderBy: DeviceOrderByInput
): DeviceConnection!
devicesTopology(deviceName: String!): Topologies
kafkaHealthCheck: IsOkResponse
labels(after: String, before: String, filter: FilterLabelsInput, first: Int, last: Int): LabelConnection!
locations(
Expand Down Expand Up @@ -937,6 +938,10 @@ type SynceTopologyVersionData {
nodes: [SynceGraphNode!]!
}

type Topologies {
topologies: [TopologyOfDevice]
}

type Topology {
edges: [GraphEdge!]!
nodes: [GraphNode!]!
Expand All @@ -953,6 +958,11 @@ enum TopologyLayer {
PTP_TOPOLOGY
}

type TopologyOfDevice {
deviceId: String!
topologyId: String!
}

enum TopologyType {
ETH_TOPOLOGY
MPLS_TOPOLOGY
Expand Down
33 changes: 33 additions & 0 deletions src/schema/nexus-typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ export interface NexusGenObjects {
edges: NexusGenRootTypes['GraphVersionEdge'][]; // [GraphVersionEdge!]!
nodes: NexusGenRootTypes['SynceGraphNode'][]; // [SynceGraphNode!]!
};
Topologies: {
// root type
topologies?: Array<NexusGenRootTypes['TopologyOfDevice'] | null> | null; // [TopologyOfDevice]
};
Topology: {
// root type
edges: NexusGenRootTypes['GraphEdge'][]; // [GraphEdge!]!
Expand All @@ -818,6 +822,11 @@ export interface NexusGenObjects {
// root type
commonNodes: string[]; // [String!]!
};
TopologyOfDevice: {
// root type
deviceId: string; // String!
topologyId: string; // String!
};
Transaction: {
// root type
changes: NexusGenRootTypes['TransactionChange'][]; // [TransactionChange!]!
Expand Down Expand Up @@ -1484,6 +1493,7 @@ export interface NexusGenFieldTypes {
deviceMetadata: NexusGenRootTypes['DeviceMetadata'] | null; // DeviceMetadata
deviceNeighbor: NexusGenRootTypes['DeviceNeighbors'] | null; // DeviceNeighbors
devices: NexusGenRootTypes['DeviceConnection']; // DeviceConnection!
devicesTopology: NexusGenRootTypes['Topologies'] | null; // Topologies
kafkaHealthCheck: NexusGenRootTypes['IsOkResponse'] | null; // IsOkResponse
labels: NexusGenRootTypes['LabelConnection']; // LabelConnection!
locations: NexusGenRootTypes['LocationConnection']; // LocationConnection!
Expand Down Expand Up @@ -1599,6 +1609,10 @@ export interface NexusGenFieldTypes {
edges: NexusGenRootTypes['GraphVersionEdge'][]; // [GraphVersionEdge!]!
nodes: NexusGenRootTypes['SynceGraphNode'][]; // [SynceGraphNode!]!
};
Topologies: {
// field return type
topologies: Array<NexusGenRootTypes['TopologyOfDevice'] | null> | null; // [TopologyOfDevice]
};
Topology: {
// field return type
edges: NexusGenRootTypes['GraphEdge'][]; // [GraphEdge!]!
Expand All @@ -1608,6 +1622,11 @@ export interface NexusGenFieldTypes {
// field return type
commonNodes: string[]; // [String!]!
};
TopologyOfDevice: {
// field return type
deviceId: string; // String!
topologyId: string; // String!
};
Transaction: {
// field return type
changes: NexusGenRootTypes['TransactionChange'][]; // [TransactionChange!]!
Expand Down Expand Up @@ -2274,6 +2293,7 @@ export interface NexusGenFieldTypeNames {
deviceMetadata: 'DeviceMetadata';
deviceNeighbor: 'DeviceNeighbors';
devices: 'DeviceConnection';
devicesTopology: 'Topologies';
kafkaHealthCheck: 'IsOkResponse';
labels: 'LabelConnection';
locations: 'LocationConnection';
Expand Down Expand Up @@ -2389,6 +2409,10 @@ export interface NexusGenFieldTypeNames {
edges: 'GraphVersionEdge';
nodes: 'SynceGraphNode';
};
Topologies: {
// field return type name
topologies: 'TopologyOfDevice';
};
Topology: {
// field return type name
edges: 'GraphEdge';
Expand All @@ -2398,6 +2422,11 @@ export interface NexusGenFieldTypeNames {
// field return type name
commonNodes: 'String';
};
TopologyOfDevice: {
// field return type name
deviceId: 'String';
topologyId: 'String';
};
Transaction: {
// field return type name
changes: 'TransactionChange';
Expand Down Expand Up @@ -2689,6 +2718,10 @@ export interface NexusGenArgTypes {
last?: number | null; // Int
orderBy?: NexusGenInputs['DeviceOrderByInput'] | null; // DeviceOrderByInput
};
devicesTopology: {
// args
deviceName: string; // String!
};
labels: {
// args
after?: string | null; // String
Expand Down
29 changes: 29 additions & 0 deletions src/schema/topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,35 @@ export const deviceNeighborQuery = queryField('deviceNeighbor', {
},
});

export const TopologyOfDevice = objectType({
name: 'TopologyOfDevice',
definition: (t) => {
t.nonNull.string('topologyId');
t.nonNull.string('deviceId');
},
});

export const Topologies = objectType({
name: 'Topologies',
definition: (t) => {
t.list.field('topologies', {
type: TopologyOfDevice,
});
},
});

export const TopologyOfDevicesQuery = queryField('devicesTopology', {
type: Topologies,
args: {
deviceName: nonNull(stringArg()),
},
resolve: async (_, args, { topologyDiscoveryGraphQLAPI }) => {
const topologyOfDevicesResult = await topologyDiscoveryGraphQLAPI?.getTopologyOfDevice(args.deviceName);

return topologyOfDevicesResult ?? { topologies: [] };
},
});

export const MplsTopology = objectType({
name: 'MplsTopology',
definition: (t) => {
Expand Down
Loading