<commit_before>declaration template quattor/types/hardware;

include 'pan/types';
include 'quattor/functions/hardware';
include 'quattor/types/annotation';
include 'quattor/physdevices';

@documentation{
    RAM definition
}
type structure_ram = {
    include structure_annotation
    "size" : long # "Size of module in MB"
    "data_rate" ? string
};


@documentation{
    CPU definition
}
type structure_cpu = {
    include structure_annotation
    "speed"  : long # "CPU clock speed in MHz"
    # Number of cores on each CPU chip, defaults to 1.
    "cores" : long(1..) = 1
    "hyperthreading" : boolean = false
};


@documentation{
    NIC definition
}
type structure_nic = {
    include structure_annotation
    "hwaddr"       : type_hwaddr
    "driver"       ? string
    "driverrpms"   ? string[]
    "media"        ? string
    "name"         ? string
    "pxe"          ? boolean
    "boot"         ? boolean
    "maxspeed"     ? long
    "role"         ? string = ''
};

@documentation{
    Rack definition
}
type structure_rack = {
  "name" : string
  "column" : string
  "room" : string
  "row" : string
};

@documentation{
    Fiber channel definition
}
type fcahwaddr = string with is_a_fcahwaddr (SELF);
type structure_fca = {
    include structure_annotation
    "hwaddr" ? fcahwaddr # "IEEE fiber Channel World Wide Name"
    "active" ? boolean # "Is this port being used"
};

@documentation{
    BMC controller
}
type structure_bmc = {
    include structure_annotation
    "hwaddr" ? type_hwaddr
};

@documentation{
    Card and/or addon
}
type structure_cards = {
    # Indexed by device name (eth0, venet0...)
    "nic" : structure_nic{}
    # Fiber channel
    "fca" ? structure_fca[]
    # For hardware RAID controllers
    "raid" ? structure_raid{}
    # For describing IDE controllers
    "ide" ? structure_raid{}
    # For describing SATA controllers
    "sata" ? structure_raid{}
    # For describing Parallel SCSI controllers
    "scsi" ? structure_raid{}
    # For describing SAS controllers
    "sas" ? structure_raid{}
    # For describing BMC controllers
    "bmc" ? structure_bmc[]
} with is_valid_card_ports (SELF);

@documentation{
    Serial console
}
type structure_serial_console = {
    include structure_annotation
    "parity" ? string with match(SELF, "^(n|p)$")
    "speed"  ? long
    "unit"   ? long
    "word"   ? long(7..8)
};

@documentation{
    Telnet console
}
type structure_telnet_console = {
    "port" : long = 23
    "fqdn" : string
};

@documentation{
    generic network console
}
type structure_generic_network_console = {
    "fqdn"      ? string
    "hwaddr"    : type_hwaddr
};

@documentation{
    IPMI console
}
type structure_ipmi_console = {
    include structure_generic_network_console
};

@documentation{
    SSH console
}
type structure_ssh_console = {
    include structure_generic_network_console
};

@documentation{
    BMC console
}
type structure_bmc_console = {
    include structure_generic_network_console
};

@documentation{
    DPC console
}
type structure_dpc_console = {
    include structure_generic_network_console
};

@documentation{
    console definition
}
type structure_console = extensible {
    "serial" ? structure_serial_console
    "telnet" ? structure_telnet_console
    "ssh"    ? structure_ssh_console
    "ipmi"   ? structure_ipmi_console
    "dpc"    ? structure_dpc_console
    "bmc"    ? structure_dpc_console
    "preferred" : string[]
};

@documentation{
    system location definition
}
type structure_sysloc = {
    "campus"     ? string
    "building"   ? string
    "city"       ? string
    "continent"  ? string
    "room"       ? string
    "bunker"     ? string
    "region"     ? string
    "dns_search_domains" ? string[]
};

@documentation{
    System benchmark results
    benchmarks is used to hold the performance benchmark for the machine
    i.e. HEPSpec06 score
    this might be used to scale things such as the wall time
    example of using this might be :
    variable CONDOR_WN_SCALING_FACTOR = value('/hardware/benchmarks/hepspec06')
          / ( 4 * get_num_of_cores()) ;
}
type structure_benchmark = {
    "hepspec06" ? double 
    "HPL" ? double @{unit: Gflops}
    "stream" ? double @{unit: MB/s TRIAD}
};

@documentation{
    Hardware definition
}
type structure_hardware = {
    include structure_annotation
    "cpu"          ? structure_cpu[]
    "ram"          ? structure_ram[]
    "cards"        ? structure_cards
    "rack"     ? structure_rack
    "console"      ? structure_console
    "sysloc"       ? structure_sysloc
    "nodename"     ? string
    "benchmarks" ? structure_benchmark
    # Obsolete field, use the appropriate "cards" sub-field instead!!
    "harddisks"    ? structure_raidport{}
};

# TODO is it ok to define variables in declartaion templates?
final variable ENC_TYPES = '^(blade|dumb|hypervisor)$';

@documentation{<commit_msg>move the using annotations to the correct locations<commit_after>declaration template quattor/types/hardware;

include 'pan/types';
include 'quattor/functions/hardware';
include 'quattor/types/annotation';
include 'quattor/physdevices';

@documentation{
    RAM definition
}
type structure_ram = {
    include structure_annotation
    "size" : long # "Size of module in MB"
    "data_rate" ? string
};


@documentation{
    CPU definition
}
type structure_cpu = {
    include structure_annotation
    "speed"  : long # "CPU clock speed in MHz"
    # Number of cores on each CPU chip, defaults to 1.
    "cores" : long(1..) = 1
    "hyperthreading" : boolean = false
};


@documentation{
    NIC definition
}
type structure_nic = {
    include structure_annotation
    "hwaddr"       : type_hwaddr
    "driver"       ? string
    "driverrpms"   ? string[]
    "media"        ? string
    "name"         ? string
    "pxe"          ? boolean
    "boot"         ? boolean
    "maxspeed"     ? long
    "role"         ? string = ''
};

@documentation{
    Rack definition
}
type structure_rack = {
  "name" : string
  "column" : string
  "room" : string
  "row" : string
};

@documentation{
    Fiber channel definition
}
type fcahwaddr = string with is_a_fcahwaddr (SELF);
type structure_fca = {
    include structure_annotation
    "hwaddr" ? fcahwaddr # "IEEE fiber Channel World Wide Name"
    "active" ? boolean # "Is this port being used"
};

@documentation{
    BMC controller
}
type structure_bmc = {
    include structure_annotation
    "hwaddr" ? type_hwaddr
};

@documentation{
    Card and/or addon
}
type structure_cards = {
    # Indexed by device name (eth0, venet0...)
    "nic" : structure_nic{}
    # Fiber channel
    "fca" ? structure_fca[]
    # For hardware RAID controllers
    "raid" ? structure_raid{}
    # For describing IDE controllers
    "ide" ? structure_raid{}
    # For describing SATA controllers
    "sata" ? structure_raid{}
    # For describing Parallel SCSI controllers
    "scsi" ? structure_raid{}
    # For describing SAS controllers
    "sas" ? structure_raid{}
    # For describing BMC controllers
    "bmc" ? structure_bmc[]
} with is_valid_card_ports (SELF);

@documentation{
    Serial console
}
type structure_serial_console = {
    include structure_annotation
    "parity" ? string with match(SELF, "^(n|p)$")
    "speed"  ? long
    "unit"   ? long
    "word"   ? long(7..8)
};

@documentation{
    Telnet console
}
type structure_telnet_console = {
    "port" : long = 23
    "fqdn" : string
};

@documentation{
    generic network console
}
type structure_generic_network_console = {
    "fqdn"      ? string
    "hwaddr"    : type_hwaddr
};

@documentation{
    IPMI console
}
type structure_ipmi_console = {
    include structure_generic_network_console
};

@documentation{
    SSH console
}
type structure_ssh_console = {
    include structure_generic_network_console
};

@documentation{
    BMC console
}
type structure_bmc_console = {
    include structure_generic_network_console
};

@documentation{
    DPC console
}
type structure_dpc_console = {
    include structure_generic_network_console
};

@documentation{
    console definition
}
type structure_console = extensible {
    "serial" ? structure_serial_console
    "telnet" ? structure_telnet_console
    "ssh"    ? structure_ssh_console
    "ipmi"   ? structure_ipmi_console
    "dpc"    ? structure_dpc_console
    "bmc"    ? structure_dpc_console
    "preferred" : string[]
};

@documentation{
    system location definition
}
type structure_sysloc = {
    "campus"     ? string
    "building"   ? string
    "city"       ? string
    "continent"  ? string
    "room"       ? string
    "bunker"     ? string
    "region"     ? string
    "dns_search_domains" ? string[]
};

@documentation{
    System benchmark results
    benchmarks is used to hold the performance benchmark for the machine
    i.e. HEPSpec06 score
    this might be used to scale things such as the wall time
    example of using this might be :
    variable CONDOR_WN_SCALING_FACTOR = value('/hardware/benchmarks/hepspec06')
          / ( 4 * get_num_of_cores()) ;
}
type structure_benchmark = {
    "hepspec06" ? double
    @{unit: Gflops}
    "HPL" ? double
    @{unit: MB/s TRIAD}
    "stream" ? double
};

@documentation{
    Hardware definition
}
type structure_hardware = {
    include structure_annotation
    "cpu"          ? structure_cpu[]
    "ram"          ? structure_ram[]
    "cards"        ? structure_cards
    "rack"     ? structure_rack
    "console"      ? structure_console
    "sysloc"       ? structure_sysloc
    "nodename"     ? string
    "benchmarks" ? structure_benchmark
    # Obsolete field, use the appropriate "cards" sub-field instead!!
    "harddisks"    ? structure_raidport{}
};

# TODO is it ok to define variables in declartaion templates?
final variable ENC_TYPES = '^(blade|dumb|hypervisor)$';

@documentation{
{'fraction_non_alphanumeric': 0.0973027989821883, 'fraction_numerical': 0.0032569974554707377, 'mean_word_length': 3.0553033429632688, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '90571', 'n_tokens_mistral': 3170, 'n_tokens_neox': 3047, 'n_words': 808}