-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.p4
executable file
·65 lines (49 loc) · 1.49 KB
/
main.p4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <core.p4>
#include <v1model.p4>
#include "include/defines.p4"
#include "include/int_definitions.p4"
#include "include/headers.p4"
#include "include/actions.p4"
#include "include/checksums.p4"
#include "include/gtp_headers.p4"
#include "include/gtp_parser.p4"
#include "include/table0.p4"
#include "include/table_add_gtp.p4"
#include "include/table_rem_gtp.p4"
#include "include/int_report.p4"
control ingress (
inout headers_t hdr,
inout local_metadata_t local_metadata,
inout standard_metadata_t standard_metadata) {
apply {
table0_control.apply(hdr, local_metadata, standard_metadata);
if(!hdr.gtp_header.isValid()) {
table_add_gtp.apply(hdr, local_metadata, standard_metadata);
}
else {
table_rem_gtp.apply(hdr, local_metadata, standard_metadata);
}
if (local_metadata.int_meta.report == 0x01) {
//clone packet for Telemetry Report
clone3(CloneType.I2E, REPORT_MIRROR_SESSION_ID, standard_metadata);
}
}
}
control egress (
inout headers_t hdr,
inout local_metadata_t local_metadata,
inout standard_metadata_t standard_metadata) {
apply {
if (IS_I2E_CLONE(standard_metadata)) {
process_int_report.apply(hdr, local_metadata, standard_metadata);
}
}
}
V1Switch(
gtp_parser(),
verify_checksum_control(),
ingress(),
egress(),
compute_checksum_control(),
gtp_deparser()
) main;