Skip to content

Commit

Permalink
switch config
Browse files Browse the repository at this point in the history
Summary:
Modeling static MPLS routes in switch config

MplsNextHop defines "Next Hop Label Forwarding Entry" as found in RFC's. This defines  label forwarding operation to perform and next hop to which MPLS packet must be forwarded. If more than one next hops are provided then MPLS packet will be ECMPed across the next hops

StaticIp2MplsRoute defines "ingress LER" route. FEC in this case is "prefix".  L3 packets destined towards network "prefix" (as determined by longest prefix match), will be  forwarded towards "nexthops". Push label forwarding operation is implied. So each nexthop must provide label stack.

StaticMplsRouteWithNextHops define "LSR" route. An incoming MPLS packet, with label on top of the label stack matching with "ingressLabel" will be forwarded to "nexthop".

Note:

Each nexthop must have same label forwarding action, this is a requirement of current ASIC, though MPLS architecture does not impose this restriction.

StaticMplsRouteWithNoNextHops defines "LSR route" either to redirect MPLS packets, with label on the top of label stack matching with "ingressLabel"  to CPU or to drop

Reviewed By: saifhhasan

Differential Revision: D14068676

fbshipit-source-id: 6906f99153d47beea3b06707ee1d6e1c2f4b78ba
  • Loading branch information
phshaikh authored and facebook-github-bot committed Apr 9, 2019
1 parent 7d123c7 commit 3ea43ee
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ add_thrift_cpp2_library(
network_address_cpp2
common/network/if/Address.thrift
)
add_thrift_cpp2_library(
mpls_cpp2
fboss/agent/if/mpls.thrift
OPTIONS
json
)
add_thrift_cpp2_library(
switch_config_cpp2
fboss/agent/switch_config.thrift
OPTIONS
json
DEPENDS
mpls_cpp2
)
add_thrift_cpp2_library(
agent_config_cpp2
Expand Down Expand Up @@ -99,8 +107,6 @@ add_thrift_cpp2_library(
add_thrift_cpp2_library(
transceiver_cpp2
fboss/qsfp_service/if/transceiver.thrift
DEPENDS
switch_config_cpp2
)
add_thrift_cpp2_library(
optic_cpp2
Expand All @@ -116,10 +122,6 @@ add_thrift_cpp2_library(
sflow_cpp2
fboss/agent/if/sflow.thrift
)
add_thrift_cpp2_library(
mpls_cpp2
fboss/agent/if/mpls.thrift
)
add_thrift_cpp2_library(
ctrl_cpp2
fboss/agent/if/ctrl.thrift
Expand Down Expand Up @@ -179,6 +181,7 @@ add_thrift_cpp2_library(
fboss_cpp2
transceiver_cpp2
switch_config_cpp2
mpls_cpp2
)
add_thrift_cpp2_library(
netlink_manager_service_cpp2
Expand Down Expand Up @@ -526,6 +529,7 @@ target_link_libraries(
packettrace_cpp2
bcmswitch_cpp2
hardware_stats_cpp2
mpls_cpp2
pcap_pubsub_cpp2
qsfp_cpp2
netlink_manager_service_cpp2
Expand Down
7 changes: 7 additions & 0 deletions fboss/agent/if/mpls.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ struct MplsAction {
2: optional MplsLabel swapLabel, // Required if action == SWAP
3: optional MplsLabelStack pushLabels, // Required if action == PUSH
}

struct MplsNextHop {
/* nexthop */
1: string nexthop
/* label forwarding action towards nexthop */
2: MplsAction labelForwardingAction
}
29 changes: 29 additions & 0 deletions fboss/agent/switch_config.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace py3 neteng.fboss
namespace py.asyncio neteng.fboss.asyncio.switch_config
namespace cpp2 facebook.fboss.cfg

include "fboss/agent/if/mpls.thrift"

/**
* Administrative port state. ie "should the port be enabled?"
Expand Down Expand Up @@ -799,6 +800,26 @@ struct StaticRouteNoNextHops {
}


struct StaticIp2MplsRoute {
/** The VRF where the static route belongs to */
1: i32 routerID = 0
/* Prefix in the format like 10.0.0.0/8 */
2: string prefix
/* mpls next hops with push labels */
3: list<mpls.MplsNextHop > nexthops
}

struct StaticMplsRouteWithNextHops {
/* Look up MPLS packet based on label */
1: mpls.MplsLabel ingressLabel
/* forward MPLS packet to nexthops */
2: list<mpls.MplsNextHop > nexthop
}

struct StaticMplsRouteNoNextHops {
1: mpls.MplsLabel ingressLabel
}

struct SflowCollector {
1: string ip
2: i16 port
Expand Down Expand Up @@ -950,4 +971,12 @@ struct SwitchConfig {
33: list<TrafficCounter> trafficCounters = []
34: list<QosPolicy> qosPolicies = []
35: list<PortQueue> defaultPortQueues = []
// Static MPLS routes with next hops
36: list<StaticMplsRouteWithNextHops> staticMplsRoutesWithNhops = []
// MPLS labels for which to drop traffic
37: list<StaticMplsRouteNoNextHops> staticMplsoutesToNull = []
// MPLS labels for which to send traffic to CPU
38: list<StaticMplsRouteNoNextHops> staticMplsRoutesToCPU = []
// ingress LER routes
39: list<StaticIp2MplsRoute> staticIp2MplsRoutes = []
}

0 comments on commit 3ea43ee

Please sign in to comment.