Пример #1
0
const std::string RmmKeyGenerator::generate_key(const NetworkInterface& interface) {
    const auto mac_address = interface.get_mac_address();

    if (!mac_address.has_value()) {
        throw KeyValueMissingError("MAC address is missing.");
    }

    return generate_key_base(interface) + mac_address.value();
}
Пример #2
0
const std::string
RmmKeyGenerator::generate_key(const ThermalZone& thermal_zone, const NetworkInterface& zone_network_interface) {
    const auto zone_nic_mac = zone_network_interface.get_mac_address();

    if (!zone_nic_mac.has_value()) {
        throw KeyValueMissingError("Zone NIC MAC address is missing.");
    }

    return generate_key_base(thermal_zone) + zone_nic_mac.value();
}
Пример #3
0
const std::string RmmKeyGenerator::generate_key(const Fan& fan, const NetworkInterface& zone_network_interface) {
    const auto zone_nic_mac = zone_network_interface.get_mac_address();
    const auto slot_id = fan.get_slot_id();

    if (!zone_nic_mac.has_value()) {
        throw KeyValueMissingError("Zone NIC MAC address is missing.");
    }

    return generate_key_base(fan) + zone_nic_mac.value() + std::to_string(static_cast<unsigned int>(slot_id));
}
Пример #4
0
const std::string
RmmKeyGenerator::generate_key(const EthernetSwitchPortVlan& vlan, const NetworkInterface& network_interface) {
    const auto vlan_id = vlan.get_vlan_id();
    const auto nic_mac = network_interface.get_mac_address();

    if ((!vlan_id.has_value()) || (!nic_mac.has_value())) {
        throw KeyValueMissingError("Unique propery not found.");
    }

    return generate_key_base(vlan) + std::to_string(vlan_id.value()) + nic_mac.value();
}
Пример #5
0
const std::string RmmKeyGenerator::generate_key(const Chassis& chassis, const NetworkInterface& nic) {
    const enums::ChassisType chassis_type = chassis.get_type();
    OptionalField<std::string> unique_property{};

    if (enums::ChassisType::Zone == chassis_type) {
        unique_property = nic.get_mac_address();
    }
    else {
        throw std::logic_error("Improper usage of RMM key generator.");
    }

    if (!unique_property.has_value()) {
        throw KeyValueMissingError(
            "Unique property for chassis of type " + std::string(chassis_type.to_string()) + " is missing");
    }

    return generate_key_base(chassis) + unique_property.value();
}