-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
# DASH pipeline utils | ||
|
||
## Overview | ||
|
||
This package includes utils to configure DASH pipeline (bmv2) via p4runtime | ||
directly. It is a supplementary of DASH SAI, which is not doable/proper to do | ||
bmv2 specific configurations. | ||
|
||
## Usage | ||
1. internal configuration of bmv2 pipeline | ||
``` | ||
dut_mac = get_mac("veth0") | ||
neighbor_mac = get_mac("veth1") | ||
P4InternalConfigTable().set(neighbor_mac = mac_in_bytes(neighbor_mac), mac = mac_in_bytes(dut_mac)) | ||
``` | ||
2. underlay routing | ||
|
||
### internal configuration of bmv2 pipeline | ||
|
||
```python | ||
neighbor_mac = "xx:xx:xx:xx:xx:xx" | ||
dut_mac = "xx:xx:xx:xx:xx:xx" | ||
internal_config = P4InternalConfigTable(target = "localhost:9559") | ||
internal_config.set(neighbor_mac = neighbor_mac, mac = dut_mac) | ||
internal_config.set(flow_enabled = 1) | ||
internal_config.get() | ||
internal_config.unset() | ||
``` | ||
underlay_routing = P4UnderlayRoutingTable() | ||
|
||
### underlay routing | ||
|
||
```python | ||
underlay_routing = P4UnderlayRoutingTable(target = "localhost:9559") | ||
underlay_routing.set(ip_prefix = '::10.0.1.0', ip_prefix_len = 120, next_hop_id = 1) | ||
underlay_routing.get(ip_prefix = '::10.0.1.0', ip_prefix_len = 120)) | ||
underlay_routing.unset(ip_prefix = '::10.0.1.0', ip_prefix_len = 120)) | ||
``` | ||
3. flow | ||
``` | ||
# decorator use_flow can be used to enable flow lookup of bmv2 pipeline for unittest class | ||
@use_flow | ||
class Test: | ||
def setUp(self): | ||
# Verify flow entry is existing and customer packet can hit this flow | ||
verify_flow(eni_mac, vnet_id, customer_packet) | ||
# Verify flow entry is not existing and customer packet cannot hit this flow | ||
verify_no_flow(eni_mac, vnet_id, customer_packet) | ||
``` |