Skip to content

Commit

Permalink
OCPBUGS-17245: ports for bonds
Browse files Browse the repository at this point in the history
  • Loading branch information
upalatucci committed Aug 3, 2023
1 parent 058739d commit 6b72f68
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/utils/interfaces/getters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ export const getIPV4Address = (iface: NodeNetworkConfigurationInterface) =>

export const getIPV6Address = (iface: NodeNetworkConfigurationInterface) =>
iface?.ipv6?.address?.[0]?.ip;

export const getPorts = (iface: NodeNetworkConfigurationInterface) =>
[
...(iface.bridge?.port?.map((port) => port.name) || []),
...(iface['link-aggregation']?.port || []),
].sort();
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '@patternfly/react-core';
import { NodeNetworkConfigurationInterface } from '@types';
import { useNMStateTranslation } from '@utils/hooks/useNMStateTranslation';
import { getPorts } from '@utils/interfaces/getters';
import { getSystemName } from '@utils/neighbors/getters';

import NeighborInformations from './NeighborInformations';
Expand All @@ -22,7 +23,7 @@ type InterfaceDrawerDetailsTabProps = {

const InterfaceDrawerDetailsTab: FC<InterfaceDrawerDetailsTabProps> = ({ selectedInterface }) => {
const { t } = useNMStateTranslation();
const ports = selectedInterface.bridge?.port?.map((port) => port.name)?.sort();
const ports = getPorts(selectedInterface);

return (
<Stack hasGutter>
Expand Down
3 changes: 2 additions & 1 deletion src/views/states/list/components/InterfacesTypeSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { LongArrowAltDownIcon, LongArrowAltUpIcon } from '@patternfly/react-icons';
import { Td, Tr } from '@patternfly/react-table';
import { NodeNetworkConfigurationInterface, V1beta1NodeNetworkState } from '@types';
import { getPorts } from '@utils/interfaces/getters';

import useDrawerInterface from '../hooks/useDrawerInterface';

Expand Down Expand Up @@ -46,7 +47,7 @@ const InterfacesTypeSection: FC<InterfacesTypeSectionProps> = memo(

{interfaces.map((iface) => {
const address = iface.ipv4?.address || iface.ipv6?.address;
const ports = iface.bridge?.port?.map((port) => port.name)?.sort();
const ports = getPorts(iface);
const Icon =
iface.state.toLowerCase() === 'up' ? LongArrowAltUpIcon : LongArrowAltDownIcon;

Expand Down

0 comments on commit 6b72f68

Please sign in to comment.