Skip to content

Commit

Permalink
Merge branch 'Azure:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mmiele authored Jun 28, 2022
2 parents 30c65ab + 7b5ce5e commit 54eca5a
Show file tree
Hide file tree
Showing 35 changed files with 174 additions and 156 deletions.
2 changes: 1 addition & 1 deletion sirius-pipeline/Dockerfile → dash-pipeline/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ RUN apt-get update && \
# RUN git clone https://github.com/marian-pritsak/DASH-1.git && \
RUN pip install gitpython
RUN pip install jinja2
# ./sai_api_gen.py rt_sirius.json --ignore-tables=appliance,eni_meter,slb_decap --sai-git-url=https://github.com/marian-pritsak/SAI.git --sai-git-branch=base --impl_filepath=./impl.cpp dash
# ./sai_api_gen.py rt_dash.json --ignore-tables=appliance,eni_meter,slb_decap --sai-git-url=https://github.com/marian-pritsak/SAI.git --sai-git-branch=base --impl_filepath=./impl.cpp dash
#g++ -I./SAI/inc/ -I./SAI/experimental/ impl.cpp -L/usr/local/lib/ -lpiprotogrpc -lpiprotobuf -lprotobuf -lgrpc++ -lpiall -lpi_dummy

ENV DEBIAN_FRONTEND noninteractive
Expand Down
14 changes: 7 additions & 7 deletions sirius-pipeline/Makefile → dash-pipeline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ DOCKER_RUN := docker run \
--network=host \
--rm

bmv2/sirius_pipeline.bmv2/sirius_pipeline.json:
bmv2/dash_pipeline.bmv2/dash_pipeline.json:
$(DOCKER_RUN) bmv2-$(USER) p4c \
-b \
bmv2 \
bmv2/sirius_pipeline.p4 \
-o bmv2/sirius_pipeline.bmv2 \
--p4runtime-files bmv2/sirius_pipeline.bmv2/sirius_pipeline_p4rt.json,bmv2/sirius_pipeline.bmv2/sirius_pipeline_p4rt.txt
bmv2/dash_pipeline.p4 \
-o bmv2/dash_pipeline.bmv2 \
--p4runtime-files bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.json,bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.txt

clean:
rm -rf bmv2/sirius_pipeline.bmv2
rm -rf bmv2/dash_pipeline.bmv2
rm -rf SAI/SAI
rm -rf SAI/lib
make -C tests/vnet_out clean

run-switch:
$(DOCKER_RUN) \
-v $(PWD)/bmv2/sirius_pipeline.bmv2/sirius_pipeline.json:/etc/dash/sirius_pipeline.json \
-v $(PWD)/bmv2/sirius_pipeline.bmv2/sirius_pipeline_p4rt.txt:/etc/dash/sirius_pipeline_p4rt.txt \
-v $(PWD)/bmv2/dash_pipeline.bmv2/dash_pipeline.json:/etc/dash/dash_pipeline.json \
-v $(PWD)/bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.txt:/etc/dash/dash_pipeline_p4rt.txt \
--name simple_switch-$(USER) \
bmv2-$(USER) \
sudo \
Expand Down
2 changes: 1 addition & 1 deletion sirius-pipeline/README.md → dash-pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ make docker
## Build pipeline
```
make clean
make bmv2/sirius_pipeline.bmv2/sirius_pipeline.json
make bmv2/dash_pipeline.bmv2/dash_pipeline.json
make sai
make test
```
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions sirius-pipeline/SAI/README.md → dash-pipeline/SAI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ optional arguments:
Example:
```
./sai_api_gen.py \
../sirius-pipeline/bmv2/sirius_pipeline.bmv2/sirius_pipeline.json \
../dash-pipeline/bmv2/dash_pipeline.bmv2/dash_pipeline.json \
--ignore-tables=appliance,eni_meter,slb_decap \
--sai-git-url=https://github.com/marian-pritsak/SAI.git \
--sai-git-branch=base \
dash
```

In this example, the input is a sirius_pipeline.json, which is a result of a P4 code compilation. The list of tables to ignore is provided to not generate API for them, because they are representing the underlay. A custom Git URL and branch can be provided. The last argument is a name of the API.
In this example, the input is a dash_pipeline.json, which is a result of a P4 code compilation. The list of tables to ignore is provided to not generate API for them, because they are representing the underlay. A custom Git URL and branch can be provided. The last argument is a name of the API.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

./sai_api_gen.py \
/bmv2/sirius_pipeline.bmv2/sirius_pipeline_p4rt.json \
/bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.json \
--ignore-tables=appliance,eni_meter,slb_decap \
--overwrite=true \
dash
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ __attribute__((constructor))
static void Init() {
nextId = 0;
const grpc::string _grpcTarget = "0.0.0.0:9559";
char test_json[] = "/etc/dash/sirius_pipeline.json";
char test_proto_json[] = "/etc/dash/sirius_pipeline_p4rt.txt";
char test_json[] = "/etc/dash/dash_pipeline.json";
char test_proto_json[] = "/etc/dash/dash_pipeline_p4rt.txt";
int dev_id = 0;

auto p4info = parse_p4info(test_proto_json);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _SIRIUS_ACL_P4_
#define _SIRIUS_ACL_P4_

#include "sirius_headers.p4"
#include "dash_headers.p4"

match_kind {
/* list of ternary values
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _SIRIUS_CONNTRACK_P4_
#define _SIRIUS_CONNTRACK_P4_

#include "sirius_headers.p4"
#include "dash_headers.p4"

#ifdef PNA_CONNTRACK

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef _SIRIUS_INBOUND_P4_
#define _SIRIUS_INBOUND_P4_

#include "sirius_headers.p4"
#include "sirius_service_tunnel.p4"
#include "sirius_vxlan.p4"
#include "sirius_acl.p4"
#include "sirius_conntrack.p4"
#include "dash_headers.p4"
#include "dash_service_tunnel.p4"
#include "dash_vxlan.p4"
#include "dash_acl.p4"
#include "dash_conntrack.p4"

control inbound(inout headers_t hdr,
inout metadata_t meta,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _SIRIUS_METADATA_P4_
#define _SIRIUS_METADATA_P4_

#include "sirius_headers.p4"
#include "dash_headers.p4"

struct encap_data_t {
bit<24> vni;
Expand All @@ -28,6 +28,7 @@ struct eni_data_t {
bit<32> cps;
bit<32> pps;
bit<32> flows;
bit<1> admin_state;
}

struct metadata_t {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef _SIRIUS_OUTBOUND_P4_
#define _SIRIUS_OUTBOUND_P4_

#include "sirius_headers.p4"
#include "sirius_acl.p4"
#include "sirius_conntrack.p4"
#include "dash_headers.p4"
#include "dash_acl.p4"
#include "dash_conntrack.p4"

control outbound(inout headers_t hdr,
inout metadata_t meta,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _SIRIUS_PARSER_P4_
#define _SIRIUS_PARSER_P4_

#include "sirius_headers.p4"
#include "dash_headers.p4"

error {
IPv4IncorrectVersion,
Expand All @@ -14,7 +14,7 @@ error {
#define IPV4_ETHTYPE 0x0800
#define IPV6_ETHTYPE 0x86dd

parser sirius_parser(packet_in packet,
parser dash_parser(packet_in packet,
out headers_t hd,
inout metadata_t meta,
inout standard_metadata_t standard_meta)
Expand Down Expand Up @@ -106,7 +106,7 @@ parser sirius_parser(packet_in packet,
}
}

control sirius_deparser(packet_out packet,
control dash_deparser(packet_out packet,
in headers_t hdr)
{
apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#include <core.p4>
#include <v1model.p4>
#include "sirius_headers.p4"
#include "sirius_metadata.p4"
#include "sirius_parser.p4"
#include "sirius_vxlan.p4"
#include "sirius_outbound.p4"
#include "sirius_inbound.p4"
#include "sirius_conntrack.p4"

control sirius_verify_checksum(inout headers_t hdr,
#include "dash_headers.p4"
#include "dash_metadata.p4"
#include "dash_parser.p4"
#include "dash_vxlan.p4"
#include "dash_outbound.p4"
#include "dash_inbound.p4"
#include "dash_conntrack.p4"

control dash_verify_checksum(inout headers_t hdr,
inout metadata_t meta)
{
apply { }
}

control sirius_compute_checksum(inout headers_t hdr,
control dash_compute_checksum(inout headers_t hdr,
inout metadata_t meta)
{
apply { }
}

control sirius_ingress(inout headers_t hdr,
control dash_ingress(inout headers_t hdr,
inout metadata_t meta,
inout standard_metadata_t standard_metadata)
{
Expand Down Expand Up @@ -85,10 +85,12 @@ control sirius_ingress(inout headers_t hdr,

action set_eni_attrs(bit<32> cps,
bit<32> pps,
bit<32> flows) {
meta.eni_data.cps = cps;
meta.eni_data.pps = pps;
meta.eni_data.flows = flows;
bit<32> flows,
bit<1> admin_state) {
meta.eni_data.cps = cps;
meta.eni_data.pps = pps;
meta.eni_data.flows = flows;
meta.eni_data.admin_state = admin_state;
}

@name("eni|dash")
Expand Down Expand Up @@ -208,6 +210,10 @@ control sirius_ingress(inout headers_t hdr,
hdr.ethernet.dst_addr;
eni_ether_address_map.apply();
eni.apply();
if (meta.eni_data.admin_state == 0) {
deny();
return;
}

if (meta.direction == direction_t.OUTBOUND) {
outbound.apply(hdr, meta, standard_metadata);
Expand All @@ -222,16 +228,16 @@ control sirius_ingress(inout headers_t hdr,
}
}

control sirius_egress(inout headers_t hdr,
control dash_egress(inout headers_t hdr,
inout metadata_t meta,
inout standard_metadata_t standard_metadata)
{
apply { }
}

V1Switch(sirius_parser(),
sirius_verify_checksum(),
sirius_ingress(),
sirius_egress(),
sirius_compute_checksum(),
sirius_deparser()) main;
V1Switch(dash_parser(),
dash_verify_checksum(),
dash_ingress(),
dash_egress(),
dash_compute_checksum(),
dash_deparser()) main;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _SIRIUS_SERVICE_TUNNEL_P4_
#define _SIRIUS_SERVICE_TUNNEL_P4_

#include "sirius_headers.p4"
#include "dash_headers.p4"

/* Encodes V4 in V6 */
action service_tunnel_encode(inout headers_t hdr,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _SIRIUS_VXLAN_P4_
#define _SIRIUS_VXLAN_P4_

#include "sirius_headers.p4"
#include "dash_headers.p4"

action vxlan_encap(inout headers_t hdr,
in EthernetAddress underlay_dmac,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 4 additions & 6 deletions documentation/general/design/dash-high-level-design.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
Note: Work in progress
Last update: 05/02/2022
Last update: 06/22/2022
---

[<< Back to parent directory](../README.md) ]
Expand Down Expand Up @@ -42,7 +41,7 @@ Last update: 05/02/2022
- [Appendix](#appendix)
- [A day in the life of a DASH packet](#a-day-in-the-life-of-a-dash-packet)
- [A day in the life of a DASH SDN controller](#a-day-in-the-life-of-a-dash-sdn-controller)
- [A day in the life of a DASH container](#a-day-in-the-life-of-a-dash-container)
- [A day in the life of a gNMI container](#a-day-in-the-life-of-a-gnmi-container)
- [References](#references)

## Introduction
Expand Down Expand Up @@ -579,14 +578,13 @@ testing](https://github.com/Azure/DASH/tree/main/test).
### A day in the life of a DASH packet

> [!NOTE] TBD - Engineering help needed.
Some of the info from Kristina's *sanitized* doc.
> Add link to the SDN packet pipeline document when ready. See PR [dash-sdn-and-packet-transform-documentation-update](https://github.com/Azure/DASH/pull/125).
### A day in the life of a DASH SDN controller

> [!NOTE] TBD - Engineering help needed.
### A day in the life of a DASH container
### A day in the life of a gNMI container

> [!NOTE] TBD - Engineering help needed.
Expand Down
Loading

0 comments on commit 54eca5a

Please sign in to comment.