Exemplo n.º 1
0
void Submodule::m_read_vlanports(const json::Value& vlans_configuration) {
    for (const auto& vlan_json : vlans_configuration.as_array()) {
        auto vlan = m_get_vlan_by_id(vlan_json["id"].as_uint());

        if (nullptr != vlan) {
            log_debug(GET_LOGGER("module"), "Reading Vlanport configuration.");
            // Read tagged ports
            for (const auto& tagged_port : vlan_json["tagged_ports"].as_array()) {
                auto port = m_get_port_by_id(tagged_port.as_uint());
                auto vlanport = VlanPort::make_vlanport();
                vlanport->attach_port(port);
                vlanport->attach_vlan(vlan);
                vlanport->set_tagging(true);
                add_vlanport(std::move(vlanport));
            }

            // Untagged ports
            for (const auto& untagged_port : vlan_json["untagged_ports"].as_array()) {
                auto port = m_get_port_by_id(untagged_port.as_uint());
                auto vlanport = VlanPort::make_vlanport();
                vlanport->attach_port(port);
                vlanport->attach_vlan(vlan);
                vlanport->set_tagging(false);
                add_vlanport(std::move(vlanport));
            }
        }
    }
}
Exemplo n.º 2
0
void Submodule::m_read_ports(const json::Value& ports_configuration) {
    for(const auto& port_json : ports_configuration.as_array()) {
        auto port = Port::make_port();
        port->read_configuration(port_json);
        add_switch_port(std::move(port));
    }
}
Exemplo n.º 3
0
void Submodule::m_read_vlans(const json::Value& vlans_configuration) {
    for (const auto& vlan_json : vlans_configuration.as_array()){
        auto vlan = Vlan::make_vlan();
        vlan->read_configuration(vlan_json);
        add_vlan(std::move(vlan));
    }
}
Exemplo n.º 4
0
void Submodule::m_read_storage_controllers_configuration(
    const json::Value& controllers_configuration) {

    for (const auto& controller_json : controllers_configuration.as_array()) {
        auto controller = StorageController::make_storage_controller();
        controller->read_configuration(controller_json);
        add_storage_controller(std::move(controller));
    }
}
Exemplo n.º 5
0
void Submodule::m_read_network_interfaces_configuration(
    const json::Value& interfaces_configuration) {

    for (const auto& interface_json : interfaces_configuration.as_array()) {
        auto interface = NetworkInterface::make_network_interface();
        interface->read_configuration(interface_json);
        add_network_interface(std::move(interface));
    }
}