facebook / fboss

Facebook Open Switching System Software for controlling network switches.
Other
866 stars 301 forks source link

How to add a resolved next hop to fboss #14

Closed vitaliy-senchyshyn closed 8 years ago

vitaliy-senchyshyn commented 8 years ago

Hi everyone,

I'm trying to configure some routes on fboss(currently with sim_agent) using fboss_route.py and wandering how can I add a route with resolved NH since everything I've tried is unresolved? Actually how to configure resolved NH (or a host which can be used as NH) at all?

Even if I try to add a route with IP of my own interface(10.10.10.1) I see the log message which tells me that the NH is unresolved(see the log below the config). I have even tried to do a hack by calling directly ArpHandler::arpUpdateRequired() from the code and I apparently the ARP entry was added(saw the log message: "Adding ARP entry for 10.10.10.2 --> 10:10:10:10:10:02") but after that when I tried to add a route with 10.10.10.2 NH I still saw this log message about unresolved NH.

BTW, why does this route appear in the table: "Added route 10.10.10.0/24@ State:CR, => 10.10.10.1@I1"? We can not route using our own IP as NH.

Now I'm really confused and don't know how to proceed.

The config is very simple: { "version": 0, "ports": [ { "logicalID": 1, "state": 2, "minFrameSize": 64, "maxFrameSize": 1500, "parserType": 1, "routable": true, "ingressVlan": 110, "speed": 0 }, { "logicalID": 2, "state": 2, "minFrameSize": 64, "maxFrameSize": 1500, "parserType": 1, "routable": true, "ingressVlan": 120, "speed": 0 } ], "vlans": [ { "name": "V110", "id": 110, "recordStats": true, "routable": true, "ipAddresses": [ "10.10.10.1" ] }, { "name": "V120", "id": 120, "recordStats": true, "routable": true, "ipAddresses": [ "20.20.20.1" ] } ], "vlanPorts": [ { "vlanID": 110, "logicalPort": 1, "spanningTreeState": 2, "emitTags": false },
{ "vlanID": 120, "logicalPort": 2, "spanningTreeState": 2, "emitTags": false } ], "defaultVlan": 110, "interfaces": [ { "intfID": 1, "routerID": 4, "vlanID": 110, "mac":"10:10:10:10:10:01", "ipAddresses": [ "10.10.10.1/24" ] }, { "intfID": 2, "routerID": 4, "vlanID": 120, "mac":"20:20:20:20:20:01", "ipAddresses": [ "20.20.20.1/24" ] }

], "arpTimeoutSeconds": 60, "arpRefreshSeconds": 20, "arpAgerInterval": 5, "proactiveArp": false }

The log:

./sim_agent --logtostderr=1 --minloglevel=0 -v=3 --config ../fboss.json I1214 20:53:57.288607 11626 SwSwitch.cpp:294] Registering state observer: IPv6Handler I1214 20:53:57.288758 11626 SwSwitch.cpp:294] Registering state observer: NeighborUpdater I1214 20:53:57.289929 11627 SwSwitch.cpp:227] hardware initialized in 0 seconds; applying initial config I1214 20:53:57.290119 11626 ThriftServer.cpp:223] libevent 2.0.21-stable method epoll I1214 20:53:57.301103 11627 Main.cpp:135] local MAC is 02:00:00:00:00:01 I1214 20:53:57.301318 11630 SwSwitch.cpp:420] preparing state update apply initial config I1214 20:53:57.301331 11630 SwSwitch.cpp:919] Loading config from local config file ../fboss.json I1214 20:53:57.312749 11630 RouteUpdater.cpp:115] Added route 10.10.10.0/24@ State:CR, => 10.10.10.1@I1 I1214 20:53:57.312891 11630 RouteUpdater.cpp:115] Added route 20.20.20.0/24@ State:CR, => 20.20.20.1@I2 I1214 20:53:57.313022 11630 RouteUpdater.cpp:115] Added route fe80::/64@ State:R, => TO_CPU I1214 20:53:57.313503 11630 SwSwitch.cpp:515] Updating state: old_gen=0 new_gen=1 I1214 20:53:57.313855 11630 SwSwitch.cpp:560] Update state took 281us I1214 20:53:57.314029 11627 FunctionScheduler.cpp:137] Starting FunctionScheduler with 4 functions. I1214 20:53:57.314059 11627 FunctionScheduler.cpp:144] - func: updateStats, period = 1000ms, delay = 0ms I1214 20:53:57.314070 11627 FunctionScheduler.cpp:144] - func: flushWarmBoot, period = 1000ms, delay = 30000ms I1214 20:53:57.314075 11627 FunctionScheduler.cpp:144] - func: DetectTransceiver, period = 1000ms, delay = 0ms I1214 20:53:57.314084 11627 FunctionScheduler.cpp:144] - func: CacheUpdateTransceiver, period = 15000ms, delay = 15000ms I1214 20:53:57.314127 11627 Main.cpp:179] Started background thread: UpdateStatsThread I1214 20:53:57.331481 11626 Main.cpp:301] serving on localhost on port 5909 I1214 21:02:43.154876 11630 SwSwitch.cpp:420] preparing state update sync fib I1214 21:02:43.154989 11630 RouteUpdater.cpp:115] Added route 10.10.10.0/24@ State:CR, => 10.10.10.1@I1 I1214 21:02:43.155028 11630 RouteUpdater.cpp:115] Added route 20.20.20.0/24@ State:CR, => 20.20.20.1@I2 I1214 21:02:43.155066 11630 RouteUpdater.cpp:115] Added route fe80::/64@ State:R, => TO_CPU I1214 21:02:43.155227 11645 ThriftHandler.cpp:86] Sync 0 routes took 363us I1214 21:02:43.155900 11648 Acceptor.cpp:395] Acceptor=0x2cc8c98 onEmpty() I1214 21:02:44.977035 11630 SwSwitch.cpp:420] preparing state update add unicast route I1214 21:02:44.977193 11630 RouteUpdater.cpp:115] Added route 7.7.7.0/24@10.10.10.1. State:, => DROP I1214 21:02:44.977212 11630 RouteUpdater.cpp:266] Could not find route for nhop : 10.10.10.1 I1214 21:02:44.977223 11630 RouteUpdater.cpp:307] Cannot resolve route 7.7.7.0/24@10.10.10.1. State:U, => DROP I1214 21:02:44.977314 11630 SwSwitch.cpp:515] Updating state: old_gen=1 new_gen=2 I1214 21:02:44.977344 11630 SwSwitch.cpp:560] Update state took 29us I1214 21:02:44.977373 11645 ThriftHandler.cpp:86] Add 1 routes took 422us I1214 21:02:44.977731 11649 Acceptor.cpp:395] Acceptor=0x2ccd228 onEmpty()

vitaliy-senchyshyn commented 8 years ago

Have found the root cause. The problem was in VRF id. In my config it was 4 whereas the one added by fboss_route.py is 0.

Therefore, closing the issue.