Skip to content

Commit

Permalink
add details about interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoMruz committed Jan 22, 2024
1 parent 5a9da16 commit 2ebe5b3
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/__generated__/topology-discovery.graphql.ts

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

5 changes: 5 additions & 0 deletions src/external-api/topology-discovery-graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ const PTP_TOPOLOGY = gql`
cursor
node {
...PtpInterfaceParts
details {
ptp_status
ptsf_unusable
admin_oper_status
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/topology.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ export function makePtpTopologyNodes(ptpDevices?: PtpTopologyQuery) {
id: interfaceNode.id,
name: interfaceNode.name,
status: getStatus(interfaceNode.status),
details: {
ptpStatus: interfaceNode.details?.ptp_status ?? null,
adminOperStatus: interfaceNode.details?.admin_oper_status ?? null,
ptsfUnusable: interfaceNode.details?.ptsf_unusable ?? null,
},
};
})
.filter(omitNullValue) ?? [],
Expand Down
7 changes: 7 additions & 0 deletions src/schema/api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,18 @@ input GraphNodeCoordinatesInput {
}

type GraphNodeInterface {
details: GraphNodeInterfaceDetails
id: String!
name: String!
status: GraphEdgeStatus!
}

type GraphNodeInterfaceDetails {
adminOperStatus: String
ptpStatus: String
ptsfUnusable: String
}

type GraphVersionEdge {
id: ID!
source: EdgeSourceTarget!
Expand Down
21 changes: 21 additions & 0 deletions src/schema/nexus-typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,17 @@ export interface NexusGenObjects {
};
GraphNodeInterface: {
// root type
details?: NexusGenRootTypes['GraphNodeInterfaceDetails'] | null; // GraphNodeInterfaceDetails
id: string; // String!
name: string; // String!
status: NexusGenEnums['GraphEdgeStatus']; // GraphEdgeStatus!
};
GraphNodeInterfaceDetails: {
// root type
adminOperStatus?: string | null; // String
ptpStatus?: string | null; // String
ptsfUnusable?: string | null; // String
};
GraphVersionEdge: {
// root type
id: string; // ID!
Expand Down Expand Up @@ -791,10 +798,17 @@ export interface NexusGenFieldTypes {
};
GraphNodeInterface: {
// field return type
details: NexusGenRootTypes['GraphNodeInterfaceDetails'] | null; // GraphNodeInterfaceDetails
id: string; // String!
name: string; // String!
status: NexusGenEnums['GraphEdgeStatus']; // GraphEdgeStatus!
};
GraphNodeInterfaceDetails: {
// field return type
adminOperStatus: string | null; // String
ptpStatus: string | null; // String
ptsfUnusable: string | null; // String
};
GraphVersionEdge: {
// field return type
id: string; // ID!
Expand Down Expand Up @@ -1306,10 +1320,17 @@ export interface NexusGenFieldTypeNames {
};
GraphNodeInterface: {
// field return type name
details: 'GraphNodeInterfaceDetails';
id: 'String';
name: 'String';
status: 'GraphEdgeStatus';
};
GraphNodeInterfaceDetails: {
// field return type name
adminOperStatus: 'String';
ptpStatus: 'String';
ptsfUnusable: 'String';
};
GraphVersionEdge: {
// field return type name
id: 'ID';
Expand Down
10 changes: 10 additions & 0 deletions src/schema/topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,22 @@ export const GraphInterfaceStatus = enumType({
members: ['ok', 'unknown'],
});

export const GraphNodeInterfaceDetails = objectType({
name: 'GraphNodeInterfaceDetails',
definition: (t) => {
t.string('ptpStatus');
t.string('adminOperStatus');
t.string('ptsfUnusable');
},
});

export const GraphNodeInterface = objectType({
name: 'GraphNodeInterface',
definition: (t) => {
t.nonNull.string('id');
t.nonNull.field('status', { type: GraphInterfaceStatus });
t.nonNull.string('name');
t.field('details', { type: GraphNodeInterfaceDetails });
},
});

Expand Down

0 comments on commit 2ebe5b3

Please sign in to comment.