Skip to content

Commit 5ccfd4e

Browse files
committed
Fix topology view issue
1 parent d7ee05d commit 5ccfd4e

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

src/utils/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ export const NODE_HOSTNAME_LABEL = 'kubernetes.io/hostname';
88
export const NO_DATA_DASH = '-';
99

1010
export const NMSTATE_I18N_NS = 'plugin__nmstate-console-plugin';
11+
12+
export const LINK_AGGREGATION = 'link-aggregation';
13+
export const BASE_IFACE = 'base-iface';

src/views/nodenetworkconfiguration/utils/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ export const GROUP = 'group';
77
export const TOPOLOGY_LOCAL_STORAGE_KEY = 'topologyNodePositions';
88
export const NODE_POSITIONING_EVENT = 'node-positioned';
99
export const GRAPH_POSITIONING_EVENT = 'graph-position-change';
10+
11+
export const OVN_K8S_MP0 = 'ovn-k8s-mp0';
12+
export const BR_INT = 'br-int';
13+
export const GENEV_SYS_PREFIX = 'genev_sys_';

src/views/nodenetworkconfiguration/utils/utils.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ import {
1414
NodeShape,
1515
NodeStatus,
1616
} from '@patternfly/react-topology';
17+
import { BASE_IFACE, LINK_AGGREGATION } from '@utils/constants';
1718
import { isEmpty } from '@utils/helpers';
1819

1920
import BridgeIcon from '../components/BridgeIcon';
2021

21-
import { GROUP, NODE_DIAMETER } from './constants';
22+
import { BR_INT, GENEV_SYS_PREFIX, GROUP, NODE_DIAMETER, OVN_K8S_MP0 } from './constants';
2223

2324
const statusMap: { [key: string]: NodeStatus } = {
2425
up: NodeStatus.success,
@@ -27,10 +28,13 @@ const statusMap: { [key: string]: NodeStatus } = {
2728
};
2829

2930
const networkTypeLevelMap = {
31+
[InterfaceType.OVS_INTERFACE]: 1,
32+
[InterfaceType.OVS_BRIDGE]: 2,
3033
[InterfaceType.LINUX_BRIDGE]: 2,
3134
[InterfaceType.VLAN]: 3,
3235
[InterfaceType.BOND]: 4,
3336
[InterfaceType.ETHERNET]: 5,
37+
[InterfaceType.INFINIBAND]: 5,
3438
};
3539

3640
export const networkNodeLevel = new Proxy(networkTypeLevelMap, {
@@ -58,25 +62,30 @@ const getIcon = (iface: NodeNetworkConfigurationInterface) => {
5862
const createNodes = (
5963
nnsName: string,
6064
interfaces: NodeNetworkConfigurationInterface[],
61-
nnceConfigredInterfaces: NodeNetworkConfigurationInterface[],
65+
nnceConfiguredInterfaces: NodeNetworkConfigurationInterface[],
6266
): NodeModel[] =>
6367
interfaces.map((iface) => {
64-
const isDerivedFromPolicy = findInterfaceByName(nnceConfigredInterfaces, iface.name);
68+
const isDerivedFromPolicy = findInterfaceByName(nnceConfiguredInterfaces, iface.name);
6569
return {
6670
id: `${nnsName}~${iface.name}~${iface.type}`,
6771
type: ModelKind.node,
6872
label: iface.name,
6973
width: NODE_DIAMETER,
7074
height: NODE_DIAMETER,
71-
visible: !iface.patch && iface.type !== InterfaceType.LOOPBACK,
75+
visible:
76+
!iface.patch &&
77+
iface.type !== InterfaceType.LOOPBACK &&
78+
iface.name !== OVN_K8S_MP0 &&
79+
iface.name !== BR_INT &&
80+
!iface.name.startsWith(GENEV_SYS_PREFIX),
7281
shape: isDerivedFromPolicy ? NodeShape.circle : NodeShape.rect,
7382
status: getStatus(iface),
7483
data: {
7584
icon: getIcon(iface),
7685
type: iface.type,
7786
bridgePorts: iface.bridge?.port,
78-
bondPorts: iface['link-aggregation']?.port,
79-
vlanBaseInterface: iface.vlan?.['base-iface'],
87+
bondPorts: iface[LINK_AGGREGATION]?.port,
88+
vlanBaseInterface: iface.vlan?.[BASE_IFACE],
8089
level: networkNodeLevel[iface.type],
8190
isDerivedFromPolicy,
8291
},

0 commit comments

Comments
 (0)