Beispiel #1
0
bool SwitchManager::writeFlow(const std::string& objId,
                              int tableId, FlowEntryPtr el) {
    FlowEntryList tmpEl;
    if (el)
        tmpEl.push_back(el);
    return writeFlow(objId, tableId, tmpEl);
}
Beispiel #2
0
void SwitchManager::gotFlows(int tableId, const FlowEntryList& flows,
                             bool done) {
    assert(tableId >= 0 &&
           static_cast<size_t>(tableId) < flowTables.size());

    FlowEntryList& fl = recvFlows[tableId];
    fl.insert(fl.end(), flows.begin(), flows.end());
    tableDone[tableId] = done;
    if (done) {
        LOG(DEBUG) << "[" << connection->getSwitchName() << "] "
                   << "Got all entries for table=" << tableId
                   << ", #flows=" << fl.size();
        checkRecvDone();
    }
}
Beispiel #3
0
bool SwitchManager::writeFlow(const std::string& objId, int tableId,
                              FlowEntryList& el) {
    bool success = true;

    assert(tableId >= 0 &&
           static_cast<size_t>(tableId) < flowTables.size());
    for (FlowEntryPtr& fe : el)
        fe->entry->table_id = tableId;
    TableState& tab = flowTables[tableId];

    FlowEdit diffs;
    tab.apply(objId, el, diffs);
    if (!syncing) {
        // If a sync is in progress, don't write to the flow tables
        // while we are reading and reconciling with the current
        // flows.
        if (!(success = flowExecutor.Execute(diffs))) {
            LOG(ERROR) << "[" << connection->getSwitchName() << "] "
                       << "Writing flows for " << objId << " failed";

        }
    }
    el.clear();

    return success;
}
Beispiel #4
0
void FlowExecutorFixture::createTestFlows() {
    flows.push_back(FlowEntryPtr(new FlowEntry()));
    FlowEntry& e0 = *(flows.back());
    e0.entry->table_id = 0;
    e0.entry->priority = 100;
    e0.entry->cookie = 0xabcd;
    match_set_reg(&e0.entry->match, 3, 42);
    match_set_dl_type(&e0.entry->match, htons(ETH_TYPE_IP));
    match_set_nw_dst(&e0.entry->match, 0x01020304);
    ActionBuilder ab0;
    ab0.SetRegLoad(MFF_REG0, 100);
    ab0.SetOutputToPort(OFPP_IN_PORT);
    ab0.Build(e0.entry);

    flows.push_back(FlowEntryPtr(new FlowEntry()));
    FlowEntry& e1 = *(flows.back());
    e1.entry->table_id = 5;
    e1.entry->priority = 50;
    match_set_in_port(&e1.entry->match, 2168);
    ActionBuilder ab1;
    ab1.SetGotoTable(10);
    ab1.Build(e1.entry);
}
Beispiel #5
0
void FlowBuilder::build(FlowEntryList& list) {
    list.push_back(build());
}