-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issue-rigid-refactor
- Loading branch information
Showing
11 changed files
with
272 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PYTHONTEST=. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.20 | ||
0.0.22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
"""RackPlaneFabric package | ||
Uses the infra_pb2 protobuf generated code | ||
to capture components, links, and connections of the | ||
RackPlane block diagram. | ||
""" | ||
|
||
from typing import Tuple | ||
|
||
if __package__ is None or __package__ == "": | ||
import generated.infra_pb2 as infra | ||
import builders as bld | ||
from keysight_chakra.closfabric import ClosFabricSwitch | ||
else: | ||
from .generated import infra_pb2 as infra | ||
from . import builders as bld | ||
from .closfabric import ClosFabricSwitch | ||
|
||
|
||
class RackPlaneFabricBuilder(bld.FabricBuilder): | ||
""" | ||
generates infrastructure of a fabric that | ||
supports connecting to switching via multiple planes | ||
""" | ||
|
||
name: str = "RackPlaneFabric" | ||
description: str = "fabric that users multiple planes inside a rack" | ||
lowest_device: bld.DeviceBuilder = None | ||
|
||
def __init__(self, host_builder: bld.DeviceBuilder, host_count: int = 1): | ||
super().__init__(self.name) | ||
assert isinstance(host_builder, bld.DeviceBuilder) | ||
|
||
rack_switch, _ = self._add_fabric_devices( | ||
host_builder, | ||
host_count, | ||
"RackSwitch", | ||
) | ||
self.lowest_device = rack_switch | ||
|
||
device_link = infra.Link( | ||
name="eth", | ||
type=infra.LinkType.LINK_ETHERNET, | ||
) | ||
self.fabric.links[device_link.name].CopyFrom(device_link) | ||
|
||
def _add_fabric_devices( | ||
self, | ||
host_builder: bld.DeviceBuilder, | ||
host_count: int, | ||
device_name: str, | ||
) -> Tuple[bld.DeviceBuilder, int]: | ||
"""Adds fabric switches to the infrastructure | ||
Returns: Tuple of the device and the number of devices | ||
""" | ||
down_link_count = int(host_builder.port_up_component.count * host_count) | ||
up_link_count = 0 | ||
device = ClosFabricSwitch(device_name, down_link_count, up_link_count) | ||
# create one rack switch per host scale up nic | ||
sw_count = host_builder.port_up_component.count | ||
self._add_device(device, sw_count) | ||
return (device, sw_count) | ||
|
||
def _add_device( | ||
self, package_builder: bld.DeviceBuilder, device_count: int | ||
) -> None: | ||
if package_builder is not None: | ||
self.fabric.devices[package_builder.device.name].CopyFrom( | ||
infra.DeviceCount( | ||
count=device_count, | ||
device=package_builder.device, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"""RackPlaneHost package | ||
Uses the infra_pb2 protobuf generated code | ||
to capture components, links, and connections of the | ||
RackPlane block diagram. | ||
""" | ||
|
||
if __package__ is None or __package__ == "": | ||
import generated.infra_pb2 as infra | ||
import builders as bld | ||
else: | ||
from .generated import infra_pb2 as infra | ||
from . import builders as bld | ||
|
||
|
||
class RackPlaneHostBuilder(bld.HostBuilder): | ||
""" | ||
generates infrastructure of a host that | ||
supports connecting to switching via multiple planes | ||
""" | ||
|
||
name = "RackPlaneHost" | ||
description = "a host with dedicated scale up and scale out NICs" | ||
|
||
def __init__( | ||
self, npu_count: int, scale_up_nic_count: int, scale_out_nic_count: int | ||
): | ||
super(RackPlaneHostBuilder).__init__() | ||
# 1. Add components | ||
npu = infra.Component(name="npu", count=npu_count, npu=infra.Npu()) | ||
scale_up_nic = infra.Component( | ||
name="scale-up-nic", count=scale_up_nic_count, nic=infra.Nic() | ||
) | ||
self._port_component = scale_up_nic | ||
|
||
# TODO: Scale OUT NICs | ||
# scale_out_nic = infra.Component( | ||
# name="scale-out-nic", count=scale_out_nic_count, nic=infra.Nic() | ||
# ) | ||
|
||
# 2. Add link & device | ||
# link is yet undetermined, using mii as placeholder with zero cost speed | ||
mii_link = infra.Link(name="mii") | ||
|
||
self._device = infra.Device( | ||
name=self.name, | ||
components={ | ||
npu.name: npu, | ||
scale_up_nic.name: scale_up_nic, | ||
# scale_out_nic.name: scale_out_nic, | ||
}, | ||
links={mii_link.name: mii_link}, | ||
) | ||
|
||
# 3. Add component links | ||
# scale UP NICs to NPU connections | ||
for c1_index in range(npu.count): | ||
for c2_index in range(scale_up_nic.count): | ||
self._add_component_link( | ||
npu.name, | ||
c1_index, | ||
mii_link.name, | ||
scale_up_nic.name, | ||
c2_index, | ||
) | ||
|
||
# TODO: Scale OUT NICs | ||
# scale OUT NICs to NPU connections | ||
# for c1_index in range(npu.count): | ||
# for c2_index in range(scale_up_nic.count): | ||
# self._add_component_link( | ||
# npu.name, | ||
# c1_index, | ||
# mii_link.name, | ||
# scale_up_nic.name, | ||
# c2_index, | ||
# ) | ||
|
||
@property | ||
def port_up_component(self) -> infra.Component: | ||
return self._port_component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.