Skip to content

Commit

Permalink
Add spdx license comments 1 (#658)
Browse files Browse the repository at this point in the history
* Move optional steps for testing VMs out of README.md file
This may help avoid new users being confused that they must follow
those instructions.

Signed-off-by: Andy Fingerhut <[email protected]>

* Add SPDX-License-Identifier line to most files.
All of the files are Apache 2.0 license.

Signed-off-by: Andy Fingerhut <[email protected]>

---------

Signed-off-by: Andy Fingerhut <[email protected]>
  • Loading branch information
jafingerhut authored Dec 23, 2024
1 parent 3acf7d1 commit 9a350e0
Show file tree
Hide file tree
Showing 121 changed files with 167 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Python byte code
*.pyc
*.pyo
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)
---

Thank you for your interest in contributing to the P4 Compiler tutorials repository! Your contributions are important and will help to improve the project for everyone. Before you begin, please consider the guidelines below.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# P4 Tutorial

* [Introduction](#introduction)
Expand Down
1 change: 1 addition & 0 deletions exercises/basic/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc
TOPO = pod-topo/topology.json

Expand Down
3 changes: 3 additions & 0 deletions exercises/basic/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing Basic Forwarding

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/basic/basic.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/basic/receive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import os
import sys

Expand Down
1 change: 1 addition & 0 deletions exercises/basic/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import random
import socket
import sys
Expand Down
1 change: 1 addition & 0 deletions exercises/basic/solution/basic.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/basic_tunnel/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc

include ../../utils/Makefile
3 changes: 3 additions & 0 deletions exercises/basic_tunnel/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing Basic Tunneling

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/basic_tunnel/basic_tunnel.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/basic_tunnel/myTunnel_header.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0


from scapy.all import *
Expand Down
1 change: 1 addition & 0 deletions exercises/basic_tunnel/receive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import os
import sys

Expand Down
1 change: 1 addition & 0 deletions exercises/basic_tunnel/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import argparse
import random
import socket
Expand Down
1 change: 1 addition & 0 deletions exercises/basic_tunnel/solution/basic_tunnel.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/calc/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc
#NO_P4 = true
#P4C_ARGS = --p4runtime-file $(basename $@).p4info --p4runtime-format text
Expand Down
3 changes: 3 additions & 0 deletions exercises/calc/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing a P4 Calculator

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/calc/calc.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */

/*
Expand Down
1 change: 1 addition & 0 deletions exercises/calc/calc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

import re

Expand Down
1 change: 1 addition & 0 deletions exercises/calc/solution/calc.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */

/*
Expand Down
1 change: 1 addition & 0 deletions exercises/ecn/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc

include ../../utils/Makefile
5 changes: 4 additions & 1 deletion exercises/ecn/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing ECN

## Introduction
Expand Down Expand Up @@ -204,4 +207,4 @@ The documentation for P4_16 and P4Runtime is available [here](https://p4.org/spe

All excercises in this repository use the v1model architecture, the documentation for which is available at:
1. The BMv2 Simple Switch target document accessible [here](https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md) talks mainly about the v1model architecture.
2. The include file `v1model.p4` has extensive comments and can be accessed [here](https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4).
2. The include file `v1model.p4` has extensive comments and can be accessed [here](https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4).
1 change: 1 addition & 0 deletions exercises/ecn/ecn.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/ecn/receive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import sys

from scapy.all import get_if_list, sniff
Expand Down
1 change: 1 addition & 0 deletions exercises/ecn/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

import socket
import sys
Expand Down
1 change: 1 addition & 0 deletions exercises/ecn/solution/ecn.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/firewall/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc
TOPO = pod-topo/topology.json
DEFAULT_PROG = basic.p4
Expand Down
3 changes: 3 additions & 0 deletions exercises/firewall/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing A Basic Stateful Firewall

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/firewall/basic.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/firewall/firewall.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/firewall/solution/firewall.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/link_monitor/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc
TOPO = pod-topo/topology.json

Expand Down
3 changes: 3 additions & 0 deletions exercises/link_monitor/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing Link Monitoring

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/link_monitor/link_monitor.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/link_monitor/probe_hdrs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
from scapy.all import *

TYPE_PROBE = 0x812
Expand Down
1 change: 1 addition & 0 deletions exercises/link_monitor/receive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

from probe_hdrs import *

Expand Down
1 change: 1 addition & 0 deletions exercises/link_monitor/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import sys
import time

Expand Down
1 change: 1 addition & 0 deletions exercises/link_monitor/solution/link_monitor.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/load_balance/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc

include ../../utils/Makefile
5 changes: 4 additions & 1 deletion exercises/load_balance/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Load Balancing

In this exercise, you will implement a form of load balancing based on
Expand Down Expand Up @@ -138,4 +141,4 @@ The documentation for P4_16 and P4Runtime is available [here](https://p4.org/spe

All excercises in this repository use the v1model architecture, the documentation for which is available at:
1. The BMv2 Simple Switch target document accessible [here](https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md) talks mainly about the v1model architecture.
2. The include file `v1model.p4` has extensive comments and can be accessed [here](https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4).
2. The include file `v1model.p4` has extensive comments and can be accessed [here](https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4).
1 change: 1 addition & 0 deletions exercises/load_balance/load_balance.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/load_balance/receive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import os
import sys

Expand Down
1 change: 1 addition & 0 deletions exercises/load_balance/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import random
import socket
import sys
Expand Down
1 change: 1 addition & 0 deletions exercises/load_balance/solution/load_balance.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/mri/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc

include ../../utils/Makefile
5 changes: 4 additions & 1 deletion exercises/mri/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing MRI

## Introduction
Expand Down Expand Up @@ -270,4 +273,4 @@ The documentation for P4_16 and P4Runtime is available [here](https://p4.org/spe

All excercises in this repository use the v1model architecture, the documentation for which is available at:
1. The BMv2 Simple Switch target document accessible [here](https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md) talks mainly about the v1model architecture.
2. The include file `v1model.p4` has extensive comments and can be accessed [here](https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4).
2. The include file `v1model.p4` has extensive comments and can be accessed [here](https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4).
1 change: 1 addition & 0 deletions exercises/mri/mri.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/mri/receive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import sys

from scapy.all import (
Expand Down
1 change: 1 addition & 0 deletions exercises/mri/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

import socket
import sys
Expand Down
1 change: 1 addition & 0 deletions exercises/mri/solution/mri.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/multicast/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc
TOPO = sig-topo/topology.json

Expand Down
3 changes: 3 additions & 0 deletions exercises/multicast/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing Multicast

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/multicast/disable_ipv6.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
1 change: 1 addition & 0 deletions exercises/multicast/multicast.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/multicast/solution/multicast.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/p4runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc

include ../../utils/Makefile
3 changes: 3 additions & 0 deletions exercises/p4runtime/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing a Control Plane using P4Runtime

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/p4runtime/advanced_tunnel.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/p4runtime/mycontroller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions exercises/p4runtime/solution/mycontroller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions exercises/qos/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
BMV2_SWITCH_EXE = simple_switch_grpc

include ../../utils/Makefile
3 changes: 3 additions & 0 deletions exercises/qos/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

[comment]: # (SPDX-License-Identifier: Apache-2.0)

# Implementing QOS

## Introduction
Expand Down
1 change: 1 addition & 0 deletions exercises/qos/qos.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
1 change: 1 addition & 0 deletions exercises/qos/receive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

import sys

Expand Down
1 change: 1 addition & 0 deletions exercises/qos/send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0

import argparse
import socket
Expand Down
1 change: 1 addition & 0 deletions exercises/qos/solution/qos.p4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
/* -*- P4_16 -*- */
#include <core.p4>
#include <v1model.p4>
Expand Down
Loading

0 comments on commit 9a350e0

Please sign in to comment.