Skip to content

Commit

Permalink
Merge pull request #351 from fabric-testbed/rel1.7
Browse files Browse the repository at this point in the history
Rel1.7 - changes
  • Loading branch information
kthare10 authored Jul 18, 2024
2 parents 324ed47 + 045e96c commit 06e7247
Show file tree
Hide file tree
Showing 14 changed files with 3,568 additions and 948 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased

### Fixed
- Error *may* be inaccurate or wrong when I issue an invalid configuration. (Issue [#304](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/304))
- Get Device Name and corresponding deprecated function (Issue[#341](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/341))
- Failures when adding interfaces to a network (Issue[#329](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/329))
- Add Facility Port to allow adding multiple interfaces (Issue [#289](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/289))
Expand All @@ -20,6 +21,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Missing docstrings in interface module (Issue [#313](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/313))
- Missing docstrings in facility_port module (Issue [#312](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/312))
- Missing docstrings in node module (Issue [#318](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/318))
- Sub Interface Support (Issue [#350](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/350))
- Advanced reservations (Issue [#345](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/345))
- Port Mirroring with Basic NICs (Issue [#343](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/343))
- P4 support (Issue [#340](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/340))
- ERO Support (Issue [#338](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/338))
- List hosts (Issue [#331](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/331))
- AL2S Support (Issue [#325](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/325))
- Deny infeasible slices (Issue [#326](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/326))
- Add display of switch port name to network service table listing (Issue [#152](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/152))

## [1.6.4] - 2024-03-05

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ help FABlib, please review the [guidelines] first.
[configuration]: https://fabric-fablib.readthedocs.io/en/latest/#configuring-fablib

[guidelines]: ./CONTRIBUTING.md


82 changes: 32 additions & 50 deletions fabrictestbed_extensions/fablib/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

import jinja2

from fabrictestbed_extensions.fablib.constants import Constants

if TYPE_CHECKING:
from fabrictestbed_extensions.fablib.slice import Slice
from fabrictestbed_extensions.fablib.node import Node
Expand All @@ -60,16 +62,17 @@

class Component:
component_model_map = {
"NIC_Basic": ComponentModelType.SharedNIC_ConnectX_6,
"NIC_ConnectX_6": ComponentModelType.SmartNIC_ConnectX_6,
"NIC_ConnectX_5": ComponentModelType.SmartNIC_ConnectX_5,
"NVME_P4510": ComponentModelType.NVME_P4510,
"GPU_TeslaT4": ComponentModelType.GPU_Tesla_T4,
"GPU_RTX6000": ComponentModelType.GPU_RTX6000,
"GPU_A40": ComponentModelType.GPU_A40,
"GPU_A30": ComponentModelType.GPU_A30,
"NIC_OpenStack": ComponentModelType.SharedNIC_OpenStack_vNIC,
"FPGA_Xilinx_U280": ComponentModelType.FPGA_Xilinx_U280,
Constants.CMP_NIC_Basic: ComponentModelType.SharedNIC_ConnectX_6,
Constants.CMP_NIC_ConnectX_6: ComponentModelType.SmartNIC_ConnectX_6,
Constants.CMP_NIC_ConnectX_5: ComponentModelType.SmartNIC_ConnectX_5,
Constants.CMP_NIC_P4: Constants.P4_DedicatedPort,
Constants.CMP_NVME_P4510: ComponentModelType.NVME_P4510,
Constants.CMP_GPU_TeslaT4: ComponentModelType.GPU_Tesla_T4,
Constants.CMP_GPU_RTX6000: ComponentModelType.GPU_RTX6000,
Constants.CMP_GPU_A40: ComponentModelType.GPU_A40,
Constants.CMP_GPU_A30: ComponentModelType.GPU_A30,
Constants.CMP_NIC_OpenStack: ComponentModelType.SharedNIC_OpenStack_vNIC,
Constants.CMP_FPGA_Xilinx_U280: ComponentModelType.FPGA_Xilinx_U280,
}

def __str__(self):
Expand Down Expand Up @@ -259,32 +262,6 @@ def list_interfaces(
fields=fields, output=output, quiet=quiet, filter_function=filter_function
)

# def list_interfaces(self) -> List[str]:
# """
# Creates a tabulated string describing all components in the slice.
#
# Intended for printing a list of all components.
#
# :return: Tabulated srting of all components information
# :rtype: String
# """
# table = []
# for iface in self.get_interfaces():
# network_name = ""
# if iface.get_network():
# network_name = iface.get_network().get_name()
#
# table.append( [ iface.get_name(),
# network_name,
# iface.get_bandwidth(),
# iface.get_vlan(),
# iface.get_mac(),
# iface.get_physical_os_interface_name(),
# iface.get_os_interface(),
# ] )
#
# return tabulate(table, headers=["Name", "Network", "Bandwidth", "VLAN", "MAC", "Physical OS Interface", "OS Interface" ])

@staticmethod
def calculate_name(node: Node = None, name: str = None) -> str:
"""
Expand Down Expand Up @@ -342,10 +319,13 @@ def __init__(self, node: Node = None, fim_component: FimComponent = None):
self.node = node
self.interfaces = None

def get_interfaces(self) -> List[Interface]:
def get_interfaces(self, include_subs: bool = True) -> List[Interface]:
"""
Gets the interfaces attached to this fablib component's FABRIC component.
:param include_subs: Flag indicating if sub interfaces should be included
:type include_subs: bool
:return: a list of the interfaces on this component.
:rtype: List[Interface]
"""
Expand All @@ -355,9 +335,12 @@ def get_interfaces(self) -> List[Interface]:
if not self.interfaces:
self.interfaces = []
for fim_interface in self.get_fim_component().interface_list:
self.interfaces.append(
Interface(component=self, fim_interface=fim_interface)
)
iface = Interface(component=self, fim_interface=fim_interface)
self.interfaces.append(iface)
if include_subs:
child_interfaces = iface.get_interfaces()
if child_interfaces and len(child_interfaces):
self.interfaces.extend(child_interfaces)

return self.interfaces

Expand Down Expand Up @@ -473,25 +456,23 @@ def get_model(self) -> str:
str(self.get_type()) == "SmartNIC"
and str(self.get_fim_model()) == "ConnectX-6"
):
return "NIC_ConnectX_6"
return Constants.CMP_NIC_ConnectX_6
elif (
str(self.get_type()) == "SmartNIC"
and str(self.get_fim_model()) == "ConnectX-5"
):
return "NIC_ConnectX_5"
return Constants.CMP_NIC_ConnectX_5
elif str(self.get_type()) == "NVME" and str(self.get_fim_model()) == "P4510":
return "NVME_P4510"
return Constants.CMP_NVME_P4510
elif str(self.get_type()) == "GPU" and str(self.get_fim_model()) == "Tesla T4":
return "GPU_TeslaT4"
return Constants.CMP_GPU_TeslaT4
elif str(self.get_type()) == "GPU" and str(self.get_fim_model()) == "RTX6000":
return "GPU_RTX6000"
return Constants.CMP_GPU_RTX6000
elif (
str(self.get_type()) == "SharedNIC"
and str(self.get_fim_model()) == "ConnectX-6"
):
return "NIC_Basic"
else:
return None
return Constants.CMP_NIC_Basic

def get_reservation_id(self) -> str or None:
"""
Expand Down Expand Up @@ -669,8 +650,9 @@ def get_user_data(self):
return {}

def delete(self):
for interface in self.get_interfaces():
interface.delete()
if self.get_interfaces():
for interface in self.get_interfaces():
interface.delete()

self.get_slice().get_fim_topology().nodes[
self.get_node().get_name()
Expand Down
38 changes: 38 additions & 0 deletions fabrictestbed_extensions/fablib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,41 @@ class Constants:
EMAIL = "email"
SSH_KEYS = "sshkeys"
EXPIRES_ON = "expires_on"
LEASE_TIME_FORMAT = "%Y-%m-%d %H:%M:%S %z"

NON_PRETTY_NAME = "non_pretty_name"
PRETTY_NAME = "pretty_name"
HEADER_NAME = "header_name"
AVAILABLE = "Available"
CAPACITY = "Capacity"
ALLOCATED = "Allocated"
VALUE = "value"

NIC_SHARED_CONNECTX_6 = "SharedNIC-ConnectX-6"
SMART_NIC_CONNECTX_6 = "SmartNIC-ConnectX-6"
SMART_NIC_CONNECTX_5 = "SmartNIC-ConnectX-5"
NVME_P4510 = "NVME-P4510"
GPU_TESLA_T4 = "GPU-Tesla T4"
GPU_RTX6000 = "GPU-RTX6000"
GPU_A30 = "GPU-A30"
GPU_A40 = "GPU-A40"
FPGA_XILINX_U280 = "FPGA-Xilinx-U280"
CORES = "Cores"
RAM = "Ram"
DISK = "Disk"
CPUS = "CPUs"
HOSTS = "Hosts"
P4_SWITCH = "P4-Switch"

CMP_NIC_Basic = "NIC_Basic"
CMP_NIC_ConnectX_6 = "NIC_ConnectX_6"
CMP_NIC_ConnectX_5 = "NIC_ConnectX_5"
CMP_NIC_P4 = "NIC_P4"
CMP_NVME_P4510 = "NVME_P4510"
CMP_GPU_TeslaT4 = "GPU_TeslaT4"
CMP_GPU_RTX6000 = "GPU_RTX6000"
CMP_GPU_A40 = "GPU_A40"
CMP_GPU_A30 = "GPU_A30"
CMP_NIC_OpenStack = "NIC_OpenStack"
CMP_FPGA_Xilinx_U280 = "FPGA_Xilinx_U280"
P4_DedicatedPort = "P4_DedicatedPort"
Loading

0 comments on commit 06e7247

Please sign in to comment.